简体   繁体   English

使用 Coda API 删除表中的所有行

[英]Delete All Rows in a Table usng Coda API

The code below, requires row id's, in order for us to delete multiple rows in a Coda table using Gogle App Script.下面的代码需要行 ID,以便我们使用 Gogle 应用脚本删除 Coda 表中的多行。

// 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?在事先不知道行 ID 的情况下,如何删除 Coda 表中的行? Or another question is how to get the list of Row ID's from a table?或者另一个问题是如何从表中获取行 ID 列表? Thanks!谢谢!

To get row ids you could use:要获取行 ID,您可以使用:

// Get row ids of all rows in the sheet:
const rowIds = await CodaAPI.getRowIds('<your sheet id>');

As far as using that information to delete your rows.至于使用该信息删除您的行。 I would need a bit more context regarding your use case to help you out.我需要更多关于您的用例的上下文来帮助您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM