get_report in Python API not returning all rows when no page / pagesize specified
I don't think I used to run into this issues but when using the Python SDK I'm getting an index out of range when looping though the report object returned by get_report when it is called without a page and pageSize:
Example code:
# Modules import sys import smartsheet import pprint #static details SourceReportID = ############# # is the the ID of the report in smartsheet where data is being pulled from #Establish authentication for smartsheet accessToken = "xxxxxxxxxxxxxx" # this is where the accessToken from smartsheet is entered ssClient = smartsheet.Smartsheet(accessToken) # get report object ssReportObj = ssClient.Reports.get_report(SourceReportID) # loop though rows of report for x in range(ssReportObj.total_row_count): # create an empty dictionary MyDict = {} # for each column in row for y in range(len(ssReportObj.columns)): # create key value pair on column title and cell value for BDS MyDict[ssReportObj.columns[y].title] = str(ssReportObj.rows[x].cells[y].value) pprint.pprint(MyDict)
when x hits 100 it gives an index out of range error
The documentation https://smartsheet.redoc.ly/#operation/getReport says:
Best Answer
-
Hi @Ryfrank
You are correct that the default is 100, which is why you're receiving the error. The default is set to 100 even if no pageSize or page is specified: I would recommend setting paging into your request.
I will also submit feedback to the documentation team that there's an additional sentence in the pageSize text that's incorrect, thank you! (You can see it talks about returning rows from a Sheet, but this request is for a Report).
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
Hi @Ryfrank
You are correct that the default is 100, which is why you're receiving the error. The default is set to 100 even if no pageSize or page is specified: I would recommend setting paging into your request.
I will also submit feedback to the documentation team that there's an additional sentence in the pageSize text that's incorrect, thank you! (You can see it talks about returning rows from a Sheet, but this request is for a Report).
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives