I script in python. I need to explain some things about how we use Smartsheet. We have a master sheet that has all of our current orders on it. We have around 200 projects, and each project has its own project sheet. When an order is placed via update request, a daily script picks up the info and creates the order on the master sheet.
To iterate through the project sheets in our scripts, we use list_sheets. list_sheets doesn't seem to list all of the sheets the service account we use for scripts is shared on. I have verified in the website GUI that the account is shared as an admin on the two sheets that won't list. We ran some test scripts and determined that the sheets don't list for two other accounts that are also shared on the sheets as admins. We were able to save the sheet as new, and it did list it. This is a good work around, however I really need to understand why the sheets are not being listed.
I recently saw the announcement that the API is changing and list_sheets is changing slightly. I ran a script that uses the old method, and new method to see if there is a difference in the listed sheets. I'm including the script below for context. Both methods returned the same list. There wasn't a difference between the two lists, so I am fairly certain I can rule out the recent changes to the list_sheets call.
I would really appreciate it anyone had an idea of why this is happening.
import smartsheet
api_token = 'xxxxxxxxxxxxxxxxxxxxxxxx'
smartsheet_client = smartsheet.Smartsheet(api_token)
def new_sheet_list_creation():
try:
response = smartsheet_client.Sheets.list_sheets(page = 1, page_size = 10000)
if response.data:
print('List of project sheets:')
new_sheet_list = []
for sheet in response.data:
new_sheet_list.append(sheet.name)
print(sheet.name)
else:
print('No sheets found in the account.')
return new_sheet_list
except Exception as e:
print(f'Error: {e}')
def old_sheet_list_creation():
try:
response = smartsheet_client.Sheets.list_sheets(include_all=True)
if response.data:
print('List of project sheets:')
old_sheet_list = []
for sheet in response.data:
old_sheet_list.append(sheet.name)
print(sheet.name)
else:
print('No sheets found in the account.')
return old_sheet_list
except Exception as e:
print(f'Error: {e}')
def main():
old_sheet_list = old_sheet_list_creation()
new_sheet_list = new_sheet_list_creation()
old_set = set(old_sheet_list)
new_set = set(new_sheet_list)
diff = old_set.symmetric_difference(new_set)
unique_values = list(diff)
print('Sheets that are in the not in the old list, but in the new.:')
print(unique_values)
if name == 'main':
main()