PivotValue

Access and modify value groups in pivot tables.

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getDisplayType()` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value-display-type` | Returns the display type describing how this pivot value is currently displayed in the table. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getFormula()` | `String` | Returns the formula used to calculate this value. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getPivotTable()` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` | Returns the `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table` which this value belongs to. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getSourceDataColumn()` | `Integer` | Returns the number of the source data column the pivot value summarizes. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getSourceDataSourceColumn()` | `https://developers.google.com/apps-script/reference/spreadsheet/data-source-column|null` | Returns the data source column the pivot value summarizes. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#getSummarizedBy()` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table-summarize-function` | Returns this group's summarization function. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#remove()` | `void` | Remove this value from the pivot table. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#setDisplayName(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` | Sets the display name for this value in the pivot table. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#setFormula(String)` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` | Sets the formula used to calculate this value. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#showAs(PivotValueDisplayType)` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` | Displays this value in the pivot table as a function of another value. |
| `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#summarizeBy(PivotTableSummarizeFunction)` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` | Sets the summarization function. |

## Detailed documentation

### `getDisplayType()`

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

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-value-display-type` --- the display type for this pivot value

#### 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`

*** ** * ** ***

### `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://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` which this value belongs to.

#### Return


`https://developers.google.com/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](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 the pivot value summarizes. This index is 1-based,
if this group summarizes source data in column "A" of the spreadsheet this method returns
`1`.

#### Return


`Integer` --- The source data column number.

#### 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 pivot value summarizes. Returns `null` if the pivot
table is not a {DataSourcePivotTableApi}.

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/data-source-column|null` --- 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](https://developers.google.com/apps-script/concepts/scopes#setting_explicit_scopes):

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

*** ** * ** ***

### `getSummarizedBy()`

Returns this group's summarization function.

#### Return


`https://developers.google.com/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](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()`

Remove this value 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`

*** ** * ** ***

### `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


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` --- the pivot value 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`

*** ** * ** ***

### `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


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` --- the pivot value 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`

*** ** * ** ***

### `showAs(displayType)`

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

#### Parameters

| Name | Type | Description |
|---|---|---|
| `displayType` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-value-display-type` | The way to display the values. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` --- the pivot value 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`

*** ** * ** ***

### `summarizeBy(summarizeFunction)`

Sets the summarization function.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `summarizeFunction` | `https://developers.google.com/apps-script/reference/spreadsheet/pivot-table-summarize-function` | The function to use to summarize data in this value's source data column. |

#### Return


`https://developers.google.com/apps-script/reference/spreadsheet/pivot-value#` --- the pivot value 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`