0

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'

Ishan
  • 4,008
  • 32
  • 90
  • 153

3 Answers3

1

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.

Ilker Baltaci
  • 11,644
  • 6
  • 63
  • 79
0

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.

Software2
  • 2,358
  • 1
  • 18
  • 28
  • include=filters does not filter our rows actually, according to docs "include=filters query string, which returns a row.filteredOut = true or false response for rows that are excluded by a filter." – Ilker Baltaci May 11 '22 at 15:07
0

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();