Class PivotValue  |  Apps Script  |  Google for Developers (original) (raw)

Class PivotValue

Stay organized with collections Save and categorize content based on your preferences.

PivotValue

Access and modify value groups in pivot tables.

Methods

Method Return type Brief description
getDisplayType() PivotValueDisplayType Returns the display type describing how this pivot value is currently displayed in the table.
getFormula() String Returns the formula used to calculate this value.
getPivotTable() PivotTable Returns the PivotTable which this value belongs to.
getSourceDataColumn() Integer Returns the number of the source data column the pivot value summarizes.
getSourceDataSourceColumn() DataSourceColumn Returns the data source column the pivot value summarizes.
getSummarizedBy() PivotTableSummarizeFunction Returns this group’s summarization function.
remove() void Remove this value from the pivot table.
setDisplayName(name) PivotValue Sets the display name for this value in the pivot table.
setFormula(formula) PivotValue Sets the formula used to calculate this value.
showAs(displayType) PivotValue Displays this value in the pivot table as a function of another value.
summarizeBy(summarizeFunction) PivotValue Sets the summarization function.

Detailed documentation

getDisplayType()

Returns the display type describing how this pivot value is currently displayed in the table.

Return

[PivotValueDisplayType](/apps-script/reference/spreadsheet/pivot-value-display-type) — the display type for this pivot value

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


getFormula()

Returns the formula used to calculate this value. If this value is not a calculated field this method returns null.

Return

String — the pivot value for chaining

Authorization

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


getPivotTable()

Returns the [PivotTable](/apps-script/reference/spreadsheet/pivot-table) which this value belongs to.

Return

[PivotTable](/apps-script/reference/spreadsheet/pivot-table) — the pivot table this value belongs to

Authorization

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


getSourceDataColumn()

Returns the number of the source data column the pivot value summarizes. This index is 1-based, if this group summarizes source data in column "A" of the spreadsheet this method returns1.

Return

Integer — The source data column number.

Authorization

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


getSourceDataSourceColumn()

Returns the data source column the pivot value summarizes. Returns null if the pivot table is not a {DataSourcePivotTableApi}.

Return

[DataSourceColumn](/apps-script/reference/spreadsheet/data-source-column) — The source data source column the pivot value summarizes.

Authorization

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


getSummarizedBy()

Returns this group’s summarization function.

Return

[PivotTableSummarizeFunction](/apps-script/reference/spreadsheet/pivot-table-summarize-function) — the group's summarization function

Authorization

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


remove()

Remove this value from the pivot table.

Authorization

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


setDisplayName(name)

Sets the display name for this value in the pivot table.

Parameters

Name Type Description
name String The display name to set.

Return

[PivotValue](#) — the pivot value for chaining

Authorization

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


setFormula(formula)

Sets the formula used to calculate this value. If this value is not a calculated field this method results in an error.

Parameters

Name Type Description
formula String The formula to use to calculate this value.

Return

[PivotValue](#) — the pivot value for chaining

Authorization

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


showAs(displayType)

Displays this value in the pivot table as a function of another value.

Parameters

Name Type Description
displayType PivotValueDisplayType The way to display the values.

Return

[PivotValue](#) — the pivot value for chaining

Authorization

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


summarizeBy(summarizeFunction)

Sets the summarization function.

Parameters

Name Type Description
summarizeFunction PivotTableSummarizeFunction The function to use to summarize data in this value's source data column.

Return

[PivotValue](#) — the pivot value for chaining

Authorization

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

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

Last updated 2024-12-03 UTC.