I’ve been trying to sync a google sheet dataset into Coda by using the Coda API. Here’s the framework of my script, which triggers every 5 minutes:
- Script will click a button that has been created in Coda to delete all rows in a table
- Script will insert all rows of the google sheets dataset into that table in Coda
This will create a sync to provide updated data into Coda, as the Google Sheets dataset updates every 5 minutes
Where I’m getting stuck is that the “pushButton” method in the API seems to be delayed. It takes a couple minutes for the rows to be deleted in Coda, after the script has run. I’ve had the trigger (every 5 minutes) on for 24 hours now and the sheet is now constantly deleting and insert rows. I’m assuming that it’s because the pushButton method is delayed and Coda queues up actions in the backend and it is just working through the backlogs of deleting + inserting that I’ve triggered through Sheets. I find that the pushing of the button is the part that is delayed; inserting rows seems instantaneous.
Is this just the way the API works or is there something I’m doing?
Here’s the code I’ve been using:
For pushing the button:
CodaAPI.pushButton(docid, deletebuttontableid, deletebuttonrowid, deletebuttoncolumnid);
For inserting rows:
CodaAPI.upsertRows(docid, tableid,body);