Class PivotFilter

  • PivotFilter is used to access and modify pivot table filters.

  • You can get or set the filter criteria for a pivot filter.

  • You can retrieve the pivot table or source data column associated with the filter.

  • A pivot filter can be removed from the pivot table.

PivotFilter

Access and modify pivot table filters.

Methods

MethodReturn typeBrief description
getFilterCriteria()FilterCriteriaReturns the filter criteria for this pivot filter.
getPivotTable()PivotTableReturns thePivotTable that this filter belongs to.
getSourceDataColumn()IntegerReturns the number of the source data column this filter operates on.
getSourceDataSourceColumn()DataSourceColumn|nullReturns the data source column the filter operates on.
remove()voidRemoves this pivot filter from the pivot table.
setFilterCriteria(filterCriteria)PivotFilterSets the filter criteria for this pivot filter.

Detailed documentation

getFilterCriteria()

Returns the filter criteria for this pivot filter.

Return

FilterCriteria — The filter criteria for this pivot filter.

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getPivotTable()

Returns thePivotTable that this filter belongs to.

Return

PivotTable — The pivot table this filter belongs to.

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • 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 are1-based, for example if this filter applies to data in column A of the spreadsheet this methodreturns "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 followingscopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

getSourceDataSourceColumn()

Returns the data source column the filter operates on. Returnsnull if the pivot tableis not a {DataSourcePivotTableApi}.

Return

DataSourceColumn|null — The data source column the filter operates on.

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • 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 followingscopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

setFilterCriteria(filterCriteria)

Sets the filter criteria for this pivot filter.

Parameters

NameTypeDescription
filterCriteriaFilterCriteriaThe filter criteria to set.

Return

PivotFilter — The pivot filter for chaining.

Authorization

Scripts that use this method require authorization with one or more of the followingscopes:

  • https://www.googleapis.com/auth/spreadsheets.currentonly
  • https://www.googleapis.com/auth/spreadsheets

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.