'Filter options in smartsheet API or SDK

I am currently exploring the smartsheet API 2.0. I want to filter based on Modified and Created date but I am unable to find any such option in the documentation.

Is there a way out to filter the smartsheet using any custom filter as we have in oData API. e.g <API URL>?$filter= createdDate ge '10/06/2019' or modified ge '10/06/2019'



Solution 1:[1]

You can create a sheet filter, and then filter the rows via the API using the include=filters param.

See the docs for more details.

Solution 2:[2]

There isn't any way to send a filter query, some alternatives :

  • You can create a filter on the fly such as described below.
  • Or you can read all the sheet content and then filter on you own

In c# filtering row would look like this:

var ssclient = new SmartsheetBuilder().SetAccessToken(token).Build();
m.Sheet sheet = ssclient.SheetResources.GetSheet(sheetId, null, null, null, null, null, null, null);
List<m.Row> rowsModifiedToday = sheet.Rows.Where(r => DateTime.ParseExact(r.Cells[columnIndex].Value.ToString(), "dd/MM/yy", null) >= DateTime.Today).ToList();

Solution 3:[3]

You need to create your filters in smartsheet since they can not be created on wire over API. Then you can call

https://api.smartsheet.com/2.0/sheets/{id}?filterId={ID}&exclude=filteredOutRows

P.S You need to enter id of your filter not the name of the filter.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Software2
Solution 2 Etienne Mermillod
Solution 3 Ilker Baltaci