Class FilterCriteria

FilterCriteria

Access filter criteria. To create a new criteria, use SpreadsheetApp.newFilterCriteria() and FilterCriteriaBuilder.

Methods

MethodReturn typeBrief description
copy()FilterCriteriaBuilderCreates a builder for a filter criteria based on this filter criteria's settings.
getCriteriaType()BooleanCriteriaReturns the boolean criteria type as defined in the BooleanCriteria enum.
getCriteriaValues()Object[]Returns an array of arguments for the boolean criteria.
getHiddenValues()String[]Returns the values to hide.
getVisibleBackgroundColor()ColorReturns the background color used as a filter criteria.
getVisibleForegroundColor()ColorReturns the foreground color used as a filter criteria.
getVisibleValues()String[]Returns the values to show.

Detailed documentation

copy()

Creates a builder for a filter criteria based on this filter criteria's settings.

You can use this method with any type of filter.

Return

FilterCriteriaBuilder — A filter criteria builder based on this filter criteria.


getCriteriaType()

Returns the boolean criteria type as defined in the BooleanCriteria enum. To get the arguments for the criteria, use getCriteriaValues(). To use these values to create or modify a filter criteria, see FilterCriteriaBuilder.withCriteria(criteria, args).

You can use this method for any type of filter.

Return

BooleanCriteria — The type of boolean criteria.


getCriteriaValues()

Returns an array of arguments for the boolean criteria. To get the boolean criteria type, use getCriteriaType(). To use these values to create or modify a filter criteria, see FilterCriteriaBuilder.withCriteria(criteria, args).

You can use this method for any type of filter.

Return

Object[] — An array of arguments appropriate to the boolean criteria type; the number of arguments and their type match the corresponding when...() method of the FilterCriteriaBuilder class.


getHiddenValues()

Returns the values to hide.

This criteria is for Grid sheet filters. Grid sheets are sheets with data that aren't connected to a database. Returns an empty array for other types of filters.

Return

String[] — An array of values to hide.


getVisibleBackgroundColor()

Returns the background color used as a filter criteria. Cells with this background color remain visible. This criteria is for filters applied to sheets within a spreadsheet. Returns null if you call this method for other types of filters.

Return

Color — The background color used as a filter criteria.


getVisibleForegroundColor()

Returns the foreground color used as a filter criteria. Cells with this foreground color remain visible.

This criteria is for Grid sheet filters. Grid sheets are sheets with data that aren't connected to a database. Returns null for other types of filters.

Return

Color — The foreground color used as a filter criteria.


getVisibleValues()

Returns the values to show.

This criteria is for filters on pivot tables that aren't connected to a database. Returns an empty array for other types of filters.

Return

String[] — An array of values to show.