Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
ExcelScript.SortBy enum
- Package:
- ExcelScript
Represents the sort direction.
Remarks
Used by
Examples
/**
* This script shows how to use setAutoSortOnCell to automatically sort
* a PivotTable's row labels based on values in a specific data column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the "Farm Pivot" PivotTable.
const pivotTable = workbook.getPivotTable("Farm Pivot");
const sheet = pivotTable.getWorksheet();
// Get the PivotTable's layout object.
const layout = pivotTable.getLayout();
// Pick a cell in the PivotTable's data area to sort by.
const sortCell1 = sheet.getRange("N6");
layout.setAutoSortOnCell(sortCell1, ExcelScript.SortBy.descending);
}
Fields
| ascending | Ascending sort. Smallest to largest or A to Z. |
| descending | Descending sort. Largest to smallest or Z to A. |
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Office Scripts
Feedback
Was this page helpful?
