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
- Customer Resources
- 64.8K Get Help
- 436 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 65 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives