ExcelScript.RowColumnPivotHierarchy interface
Represents the Excel RowColumnPivotHierarchy.
/**
* This sample sorts the rows of a PivotTable.
*/
function main(workbook: ExcelScript.Workbook) {
// Get an existing PivotTable.
const pivotTable = workbook.getPivotTable("Farm Sales");
// Get the data hierarchy to use as the basis of the sort.
const valueFieldToSortOn: ExcelScript.DataPivotHierarchy = pivotTable.getDataHierarchy("Sum of Crates Sold Wholesale");
// Get the row to sort.
const rowToSort: ExcelScript.RowColumnPivotHierarchy = pivotTable.getRowHierarchy("Farm");
// Sort the "Farm" row's only field by the values in "Sum of Crates Sold Wholesale".
rowToSort.getFields()[0].sortByValues(ExcelScript.SortBy.descending, valueFieldToSortOn);
}
get |
Returns the PivotFields associated with the RowColumnPivotHierarchy. |
get |
ID of the RowColumnPivotHierarchy. |
get |
Name of the RowColumnPivotHierarchy. |
get |
Gets a PivotField by name. If the PivotField does not exist, then this method returns |
get |
Position of the RowColumnPivotHierarchy. |
set |
Name of the RowColumnPivotHierarchy. |
set |
Position of the RowColumnPivotHierarchy. |
set |
Reset the RowColumnPivotHierarchy back to its default values. |
Returns the PivotFields associated with the RowColumnPivotHierarchy.
getFields(): PivotField[];
Returns
ID of the RowColumnPivotHierarchy.
getId(): string;
Returns
string
Name of the RowColumnPivotHierarchy.
getName(): string;
Returns
string
Gets a PivotField by name. If the PivotField does not exist, then this method returns undefined
.
getPivotField(name: string): PivotField | undefined;
Parameters
- name
-
string
Name of the PivotField to be retrieved.
Returns
ExcelScript.PivotField | undefined
Position of the RowColumnPivotHierarchy.
getPosition(): number;
Returns
number
Name of the RowColumnPivotHierarchy.
setName(name: string): void;
Parameters
- name
-
string
Returns
void
Position of the RowColumnPivotHierarchy.
setPosition(position: number): void;
Parameters
- position
-
number
Returns
void
Reset the RowColumnPivotHierarchy back to its default values.
setToDefault(): void;
Returns
void
Office Scripts feedback
Office Scripts is an open source project. Select a link to provide feedback: