0

我正在使用 Smart Sheet Python API。

如何使用相同的工作表 ID 完全更新数据?

我的方法是遍历列并删除它们(或删除 rowID)以清除现有工作表。我现在如何将新数据加载到同一张表中,这样我就不必重新共享它等?

有没有更有效的方法?

4

1 回答 1

2

您也可以使用copy_sheet函数。这将创建当前工作表的副本,然后使用includes参数可以指定是复制数据,还是将共享用户包含在副本中。

在您的情况下,听起来您希望拥有相同共享用户的工作表的空白副本。Python 中的调用看起来像这样:

copy_response = ss_client.Sheets.copy_sheet(
        sheet_ID,                                 # sheet_id
        ss_client.models.ContainerDestination({
            'destination_type': 'home',           # folder, workspace, or home
            'destination_id': None,               # folder_id
            'new_name': 'newSheetName'
        }),
        'shares'      # includes
)
print(copy_response)

有关可用的完整列表,请includes查看Copy Sheet的 Smartsheet API Docs 部分。

于 2018-08-06T23:11:51.083 回答