1

我试图用 python API 复制一张工作表,但每次我这样做时,它只包括格式(列名和行数),但我希望它包括数据。有什么办法可以做到这一点吗?我也用模板尝试过它,同样的事情发生它创建一个新工作表但它没有任何数据。

回答问题后编辑的代码:

inc_list = ['data'] # you can add other parameters here, separated by a comma
response = ss_client.Sheets.copy_sheet(
sheetID,                               # sheet_id
ss_client.models.ContainerDestination({
'destination_type': 'folder',               # folder, workspace, or home
'destination_id': folderID,         # folder_id
'new_name': cellValue,
}),
include=inc_list
)
4

1 回答 1

1

有一个需要添加的包含参数。

例如,

    inc_list = ["data"]
    sht = SmSh.Sheets.copy_sheet(src_sheet_id,
                                 SmSh.models.ContainerDestination({
                                 "destination_type": "folder",
                                 "destination_id": dest_id,
                                 "new_name": new_sheet_name}),
                                 include=inc_list
                                 )

请注意,dest_id 和 new_sheet_name 也是在此代码段上方设置的参数,未显示。

包含参数的完整列表显示在 SDK 文档中: https ://smartsheet-platform.github.io/api-docs/?python#copy-sheet

克雷格

于 2018-07-23T17:51:57.003 回答