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获取文件夹中的工作表ID数组_Python_Api_Smartsheet Api_Smartsheet Api 2.0 - Fatal编程技术网

如何使用python获取文件夹中的工作表ID数组

如何使用python获取文件夹中的工作表ID数组,python,api,smartsheet-api,smartsheet-api-2.0,Python,Api,Smartsheet Api,Smartsheet Api 2.0,当我尝试从get.folder()调用中获取id数组时(通过使用folder=folder.sheets.id),我得到的答案是:“AttributeError:'TypedList'对象没有属性'id'”。我不确定在python中调用什么函数来获取文件夹中的工作表id数组 我正试图用python smartsheet sdk来实现这一点,但我不确定具体如何格式化它 inc_list = ['all'] # you can add other parameters here, separated

当我尝试从get.folder()调用中获取id数组时(通过使用folder=folder.sheets.id),我得到的答案是:“AttributeError:'TypedList'对象没有属性'id'”。我不确定在python中调用什么函数来获取文件夹中的工作表id数组

我正试图用python smartsheet sdk来实现这一点,但我不确定具体如何格式化它

inc_list = ['all'] # you can add other parameters here, separated by a comma
 response = ss_client.Folders.copy_folder(
  folderID,                           # folder_id
  ss_client.models.ContainerDestination({
    'destination_id': destinationID,
    'destination_type': 'folder',
    'new_name': cellValue
  }),
include=inc_list
)

copiedFolderID = response.result.id

folder = ss_client.Folders.get_folder(
  copiedFolderID)       # folder_id 

newFolder = folder.sheets.id

print (newFolder)

还感谢您帮助回答我的问题,我非常感谢。

要获得文件夹中图纸的图纸ID列表,您的Python应该如下所示

my_folder = ss_client.Folders.get_folder(folder_id)

for sheet in my_folder.sheets:
    print(sheet.id)

文件夹.sheets
是一个数组。出现错误的原因是,在数组级别没有
id
属性-您需要查看数组中的各个元素

请看一看,以获得您将收到的示例

sheet_ids = []
for sheet in folder.sheets
    sheet_ids.append(sheet.id)
print(sheet_ids)

可能的重复工作!非常感谢,现在我可以开始创建用于编辑所有文档名称的循环了。