当我尝试从 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)
也感谢您帮助回答我的问题,我真的很感激。
最佳答案
folder.sheets
是一个数组。您收到错误的原因是数组级别没有 id
属性 - 您需要查看数组中的各个元素。
看看 API docs获取您将收到的示例。
sheet_ids = []
for sheet in folder.sheets
sheet_ids.append(sheet.id)
print(sheet_ids)
关于python - 如何使用python获取文件夹中的工作表ID数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51658266/