Code API - Delete All Rows in a Table

The code below, requires row IDS, in order for us to delete multiple rows in a Coda table using Gogle App Script.

// Import the CodaAPI library via Resource->Libraries...:
    CodaAPI.authenticate('<your API token>');
var body = {
             'rowIds': ['i-aBcDeFgH', 'i-AbCdEfGh'],
   CodaAPI.deleteRows('<doc ID>', '<table ID>', body);
   Logger.log('Deleted 2 rows');

How will I delete rows in a Coda table without the knowledge of row ID’s beforehand ? Or another question is how to get the list of Row ID’s from a table? Thanks!

Hey @Alyssa_Gono! There’s a deleteRow (singular) method you can use where you can pass the “name” of the row (the display column value) to delete a single row. If you want to bulk delete rows, you can get row ids by calling listRows to get the contents of a table, which will include both cell values and row ids.
Hope that helps! Feel free to reach out to support directly or follow up here if you need any more help.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.