Coda API - pushButton delay

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:

  1. Script will click a button that has been created in Coda to delete all rows in a table
  2. 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);

Hi @Enoch_Chan,

Welcome to the Coda Community!

I believe your questions were being answered through our support channel, but I wanted to post a quick reply here so others would also know what what to expect.

When pushing a column button, row operations will go in order and therefore take a little bit of time to complete. This is due to the fact that depending on your filter or formula, one rows deletion or change may affect what needs to happen to the next row.

Also, this looks like it’s a more aggressive use-case than what Coda’s API was designed for. This involves quite a few changes happening very often. Database storage setups can handle more input and output mostly because the viewing features are somewhat outside the system and just referencing it. Coda does both of these jobs together which has a lot of benefits, it’s just not setup to be full database storage.

1 Like