Not all rows are fetching from my Python Script!
I have written a script to fetch all data from a Smartsheet. i am using Smartsheet's get_sheet('sheet_id') method to fetch my Smartsheet, which has 500 rows but i am only getting exactly 300 row objects, after 300 row objects an error like this being thrown "Too large to show contents. Max items to show 300".
But the total_row_count in the Smartsheet result object is showing correctly,
code,
sheet_id = ' #my Smartsheet id here'
smart_sheet_token = smartsheet.Smartsheet(' #my access_token here')
smart_sheet = smart_sheet_token.Sheets.get_sheet(sheet_id)
#here getting my Smartsheet, only 300 rows out of 500 are returned
Can anyone help?
Comments
-
Hi Shashikiran,
As you've found through that error, the Smartsheet API has a limit to the number of results a call can return. See the Work at Scale section of our API documentation for details on request limits and information on how you can combat them with pagination: https://smartsheet-platform.github.io/api-docs/?python#work-at-scale
One recommendation is to put this call in a function (possibly recursive) that runs the get sheet based on the optional page number and page size query parameters. (Full sheet object information here: https://smartsheet-platform.github.io/api-docs/?python#get-sheet)
You can make this function submit pages based on a delay with a timer in python, this will automate your call to get all of the information you need: https://smartsheet-platform.github.io/api-docs/?python#get-sheet
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives