The error you're encountering indicates an attempt to access the 'tp' property of something that is undefined. In your code, this happens on the line where you try to access element.summary.pai.tp:
Change:
var totalPai = element.summary.pai.tp;
To:
var totalPai = element.summary.pai && element.summary.pai.tp ? element.summary.pai.tp : '';
Apparently, the element.summary.pai object is undefined in some cases, leading to the mentioned error. To fix this, you can add checks to ensure that the properties are present before accessing them.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for sharing! I am looking to use this for a school project. Problem is, I am getting this error after trying to sync in google sheets:
TypeError: Cannot read property 'tp' of undefined
Do you have any idea how I can fix this?
Found it!
The error you're encountering indicates an attempt to access the 'tp' property of something that is undefined. In your code, this happens on the line where you try to access element.summary.pai.tp:
Change:
var totalPai = element.summary.pai.tp;
To:
var totalPai = element.summary.pai && element.summary.pai.tp ? element.summary.pai.tp : '';
Apparently, the element.summary.pai object is undefined in some cases, leading to the mentioned error. To fix this, you can add checks to ensure that the properties are present before accessing them.