Does SmartSheet support any CURL to get the total row count in a sheet?

pchadha
pchadha
edited 12/09/19 in API & Developers

 

I am using curl with REST to access Smartshets in my C# running on WIN CE. My application is supposed to dump some data on smartsheet periodically.

Before I write to a sheet, I would like to know the total row count in the sheet so that I don't exceed 5000 rows per sheet.

I am looking for an API that would return just row count given the sheet id?

Currently using below API which returns the entire sheet data and takes very long to fetch and format. curl https://api.smartsheet.com/2.0/sheets/{sheetId}

with data of upto 5000 rows per sheet, it takes very long to fetch and format the response having all the row data for each cell.

 

Comments

  • dAVE Inden
    dAVE Inden Employee

    This question was asked on StackOverflow as well. Here is the answer I provided on that post:

    There isn't a request to specifically return the number of rows on a Sheet. But, with any GET /sheets/{sheetId} operation the resulting Sheet object returned will have a top level totalRowCount attribute on it. So, you don't have to GET the sheet and count the objects in the rows array. Instead you can look to the totalRowCount attribute and the value there to know how many rows are currently on the sheet.

    If you are concerned about pulling down all of the Sheet data you can use paging to keep from getting all of the data returned. Doing a GET /sheets/{sheetId}?pageSize=1 will give you the Sheet object with only the first row of data to help make the payload smaller. The totalRowCountattribute will still be present in the response.