Error Syncing Google Sheets to Coda

Hello!
I followed the tutorial below and was able to sync a google sheet to Coda, thanks for the tutorial!
How to sync data from Coda to Google Sheets (and vice versa) with Google Apps Script tutorial

The issue I am running into is I get the following error:

TypeError: Cannot read property 'length' of undefined
updateCoda@ Code.gs:103
runSync @ Code.gs:39

There’s a loop on line 103 and something isn’t being defined before that loop starts. When I ran the debugger, the only variable that was undefined was updateTargetRows on line 129, maybe that’s the issue? I’m not sure though.

The script still works, my table gets updated in Coda and everything. I’m just worried that this might cause issues down the line.

Here’s a direct link to the github page: coda-google-apps-script/sheets_to_coda.js at master · al-codaio/coda-google-apps-script · GitHub

Thanks!

Hey Samuel, this is a good question for Developer Central. I’m going to go ahead and move your post to see if we can get more movement on this considering. Hope that’s okay!

1 Like

line 103 compares the length property of two items, both indexed by i and j.

so one of those items end up with no length attribute and causes this error

but you say the updates are all done anyway

so that makes me suspect that the indexes i and j are going out-of-bounds in some way after the loops have run correctly. or you have an item in the arrays that is null or some value with no length, probably at the end.

so double check your code for setting up the loops for indexes i and j

alas, i can not suggest anything more given the little info i have on this

max

1 Like