Not sure how you're running your script or exact end goal. Assuming it's python, if you bring in Pandas, you can easily take the List of data you receive from the API call, covert that to a pandas dataframe and export that to an excel sheet. Then you don't have to define each specific returned value as a variable and account for each of them if you are just looking to get data exported quickly into a usable format. 3 lines of code. from datetime import datetime
import pandas as pd
import meraki
<some code not shown for example>
try:
devicestatuses = dashboard.organizations.getOrganizationDevicesStatuses(org_id, total_pages='all')
except meraki.APIError as e:
print(f'Meraki API error: {e}')
print(f'status code = {e.status}')
print(f'reason = {e.reason}')
print(f'error = {e.message}')
continue
except Exception as e:
print(f'some other error: {e}')
continue
# Convert devicestatuses to Dataframe.
df_devicestatuses = pd.DataFrame(devicestatuses)
#
# Variables
#
todays_date = f'{datetime.now():%Y-%m-%d}'
time_of_run = f'{datetime.now():%H-%M-%S}'
outputfilename = f'Device Statuses - {todays_date}_{time_of_run}.xlsx'
# Takes output file and creates XLSX file. index=False removes first index column.
df_devicestatuses.to_excel(outputfilename, index=False, engine='openpyxl')
... View more