1

When creating a Filter View directly in Google Sheets you have the option to 'Filter by color', 'Filter by condition' or 'Filter by value'.

Im trying to create a Filter View via the sheets API that uses the 'Filter by value' option but can't see how to do this. The relevant java class - FilterCriteria only seems to allow color and condition.

To try to see how to do it I manually created a Filter View using values in a test spreadsheet and then retrieved it using the sheets API but it then doesn't seem to contain anything about the values its based on?

Is this possible to do and if so does anyone have an example of how to do it? Or is it not possible and you need to use conditions instead (maybe something to do with the fact it's using actual data in the sheet?)

If it's not possible it seems there would be cases (eg a list of values) where its not possible to set up a corresponding condition. I tried to use a 'ONE_OF_LIST' condition also but the API threw an error saying that's not allowed in Filter Criteria.

David Geary
  • 1,756
  • 2
  • 14
  • 23
  • 1
    What about ``setHiddenValues()``? – TheMaster Jun 29 '22 at 10:24
  • Hidden values sets ones to hide, I want to set ones to show. When I did the test of setting values in the sheet UI and retrieving via the API hiddenvalues was still empty. – David Geary Jun 29 '22 at 11:42
  • 2
    Related: https://stackoverflow.com/questions/51497982/apply-basic-filter-to-multiple-values-in-a-spreadsheet-column https://issuetracker.google.com/issues/159051708 https://stackoverflow.com/questions/60919232/add-filter-to-pivottable – TheMaster Jun 29 '22 at 12:41

0 Answers0