Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Python API在Smartsheet中复制工作表_Python_Api_Smartsheet Api_Smartsheet Api 2.0 - Fatal编程技术网

使用Python API在Smartsheet中复制工作表

使用Python API在Smartsheet中复制工作表,python,api,smartsheet-api,smartsheet-api-2.0,Python,Api,Smartsheet Api,Smartsheet Api 2.0,我试图用pythonapi复制一个工作表,但每次都只包含格式(列名和行数),但我希望它包含数据。我有什么办法可以做到这一点吗?我也用模板试过了,同样的事情发生了,它创建了一个新的工作表,但没有任何数据 回答问题后编辑的代码: inc_list = ['data'] # you can add other parameters here, separated by a comma response = ss_client.Sheets.copy_sheet( sheetID,

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

回答问题后编辑的代码:

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
)

需要添加一个include参数

比如说,

    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文档中显示了包含参数的完整列表:


克雷格

你想用的是Excel吗?如果是,请在您的问题中添加相应的标记。Smartsheet api是我尝试使用的,标记更改成功!非常感谢,我很感激。我知道我需要调用来包含数据(和其他参数),我只是不确定在python中如何使用。我不认为这在文档的python部分中被引用,所以这就是我在这里发布的原因。