PivotFilter

Access and modify pivot table filters.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#getFilterCriteria()` | `https://developers.google.com/apps-script/reference/spreadsheet/filter-criteria` | Returns the filter criteria for this pivot filter. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#getPivotTable()` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` | Returns the `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` that this filter belongs to. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#getSourceDataColumn()` | `Integer` | Returns the number of the source data column this filter operates on. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#getSourceDataSourceColumn()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-column|null` | Returns the data source column the filter operates on. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#remove()` | `void` | Removes this pivot filter from the pivot table. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#setFilterCriteria(FilterCriteria)` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#` | Sets the filter criteria for this pivot filter. |

## Detailed documentation

### `getFilterCriteria()`

Returns the filter criteria for this pivot filter.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/filter-criteria` --- The filter criteria for this pivot filter.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `getPivotTable()`

Returns the `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` that this filter belongs to.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` --- The pivot table this filter belongs to.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `getSourceDataColumn()`

Returns the number of the source data column this filter operates on. These indices are
1-based, for example if this filter applies to data in column A of the spreadsheet this method
returns "1."

#### Return


`Integer` --- The number of the source data column this filter applies to.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `getSourceDataSourceColumn()`

Returns the data source column the filter operates on. Returns `null` if the pivot table
is not a {DataSourcePivotTableApi}.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-column|null` --- The data source column the filter operates on.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `remove()`

Removes this pivot filter from the pivot table.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`

*** ** * ** ***

### `setFilterCriteria(filterCriteria)`

Sets the filter criteria for this pivot filter.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `filterCriteria` | `https://developers.google.com/apps-script/reference/spreadsheet/filter-criteria` | The filter criteria to set. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-filter#` --- The pivot filter for chaining.

#### Authorization

Scripts that use this method require authorization with one or more of the following [scopes](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

- `https://www.googleapis.com/auth/spreadsheets.currentonly`
- `https://www.googleapis.com/auth/spreadsheets`