I'm working with smartsheet and the problem I'm facing that I want to know whether it's crossed the maximum limit, i.e, 5000 or not before getting 400 BAD request so I can change the sheet. can any one help me out with this thanks in advance. Solution required in JAVA
1 Answers
Since there isn't an API operation that allows you to just request specifically the count of rows in a sheet, you'll need to submit a Get Sheet request for the sheet, and then evaluate the value of the totalRowCount
property in the response.
To minimize the size of the response, you should set the page
parameter to 1
and the pageSize
parameter to 1
in the Get Sheet request. This'll make it so that only 1 row of data is included in the response (instead of the default behavior, which would return 100 rows of data).
The page in the docs I've linked to above contains a code sample for how to submit a Get Sheet request using the Smartsheet Java SDK -- but you'll need to additionally include the 2 parameters as I've described above.
(Note: I edited this answer on 3/13 to include info about the approach described below by @timwwells' comment. Thanks, Tim!)

- 13,125
- 2
- 16
- 21
-
I would just request the first page with a page size of 1 (query parameters `page` and `pageSize`). That way you'll only get back a single row, but the `totalRowCount` will still contain the total row count for the sheet (not the total row count of the response). The Java SDK takes `page` and `pageSize` arguments to the `getSheet` call. – timwells Mar 13 '20 at 14:06
-
Good suggestion, Tim -- I'll update the answer accordingly! – Kim Brandl Mar 13 '20 at 15:57