Class PivotValue

PivotValue

Access and modify value groups in pivot tables.

Methods

MethodReturn typeBrief description
getDisplayType()PivotValueDisplayTypeReturns the display type describing how this pivot value is currently displayed in the table.
getFormula()StringReturns the formula used to calculate this value.
getPivotTable()PivotTableReturns the PivotTable which this value belongs to.
getSummarizedBy()PivotTableSummarizeFunctionReturns this group’s summarization function.
setDisplayName(name)PivotValueSets the display name for this value in the pivot table.
setFormula(formula)PivotValueSets the formula used to calculate this value.
showAs(displayType)PivotValueDisplays this value in the pivot table as a function of another value.
summarizeBy(summarizeFunction)PivotValueSets the summarization function.

Detailed documentation

getDisplayType()

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

Return

PivotValueDisplayType — the display type for this pivot value

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

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:

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

getPivotTable()

Returns the PivotTable which this value belongs to.

Return

PivotTable — the pivot table this value belongs to

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

getSummarizedBy()

Returns this group’s summarization function.

Return

PivotTableSummarizeFunction — the group's summarization function

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

setDisplayName(name)

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

Parameters

NameTypeDescription
nameStringThe 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:

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

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

NameTypeDescription
formulaStringThe 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:

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

showAs(displayType)

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

Parameters

NameTypeDescription
displayTypePivotValueDisplayTypeThe 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:

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

summarizeBy(summarizeFunction)

Sets the summarization function.

Parameters

NameTypeDescription
summarizeFunctionPivotTableSummarizeFunctionThe 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:

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

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.