Skip to content Skip to sidebar Skip to footer

How To Get The Array Of Sheet Ids In A Folder With Python

When I try to get the id array from the get.folder() call (by using folder = folder.sheets.id), I get the answer: 'AttributeError: 'TypedList' object has no attribute 'id'' I'm not

Solution 1:

folder.sheets is an array. The reason you're getting an error is because there is no id attribute at the array level - you need to look at the individual elements inside the array.

Take a look at the API docs to get an example of what you'd receive.

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

Solution 2:

To get a list of the sheetIds for sheets in a folder, your Python would look something like this.

my_folder = ss_client.Folders.get_folder(folder_id)

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

Post a Comment for "How To Get The Array Of Sheet Ids In A Folder With Python"