Access and modify existing filters. To create a new filter, use Range.createFilter()
.
Methods
Method | Return type | Brief description |
---|---|---|
getColumnFilterCriteria(columnPosition) | FilterCriteria | Gets the filter criteria on the specified column, or null if no filter criteria is set. |
getRange() | Range | Gets the range this filter is applied to. |
remove() | void | Removes this filter. |
removeColumnFilterCriteria(columnPosition) | Filter | Removes the filter criteria from the specified column. |
setColumnFilterCriteria(columnPosition, filterCriteria) | Filter | Sets the filter criteria on the specified column. |
sort(columnPosition, ascending) | Filter | Sorts the filtered range by the specified column, excluding the first row (the header row) in the range this filter is applied to. |
Detailed documentation
getColumnFilterCriteria(columnPosition)
Gets the filter criteria on the specified column, or null
if no filter criteria is set.
Parameters
Name | Type | Description |
---|---|---|
columnPosition | Integer | The 1-indexed position of the column. |
Return
FilterCriteria
— the filter criteria
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getRange()
remove()
Removes this filter.
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
removeColumnFilterCriteria(columnPosition)
Removes the filter criteria from the specified column.
Parameters
Name | Type | Description |
---|---|---|
columnPosition | Integer | The 1-indexed position of the column. |
Return
Filter
— the filter, for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
setColumnFilterCriteria(columnPosition, filterCriteria)
Sets the filter criteria on the specified column.
Parameters
Name | Type | Description |
---|---|---|
columnPosition | Integer | The 1-indexed position of the column. |
filterCriteria | FilterCriteria | The filter criteria to set. If null , remove filter criteria from
the specified column; alternatively, use removeColumnFilterCriteria(columnPosition) . |
Return
Filter
— the filter, for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
sort(columnPosition, ascending)
Sorts the filtered range by the specified column, excluding the first row (the header row) in the range this filter is applied to.
Parameters
Name | Type | Description |
---|---|---|
columnPosition | Integer | The 1-indexed position of the column. |
ascending | Boolean | If true , sort the filtered range in ascending order; if false ,
sort the filtered range in descending order. |
Return
Filter
— the filter, for chaining
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets