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
- Customer Resources
- 64.7K Get Help
- 433 Global Discussions
- 136 Industry Talk
- 468 Announcements
- 4.9K Ideas & Feature Requests
- 143 Brandfolder
- 147 Just for fun
- 64 Community Job Board
- 466 Show & Tell
- 32 Member Spotlight
- 2 SmartStories
- 298 Events
- 36 Webinars
- 7.3K Forum Archives