ExcelScript.SortMethod enum
Remarks
Examples
/**
* This script sorts a range using the values in the first column.
*/
function main(workbook: ExcelScript.Workbook) {
// Get the range (A1:D8) to sort from the current worksheet.
const worksheet = workbook.getActiveWorksheet();
const rangeToSort = worksheet.getRange("A1:D8");
// Create a SortField for text sorting.
let valueSort: ExcelScript.SortField = {
ascending: true,
key: 0, /* First column */
sortOn: ExcelScript.SortOn.value
};
// Apply the SortField to the range.
rangeToSort.getSort().apply(
[valueSort],
false, /* Don't let casing have an impact of sorting. */
true, /* The range has headers. */
ExcelScript.SortOrientation.rows,
ExcelScript.SortMethod.pinYin /* Use phonetic sorting for Chinese characters. */
);
}
Fields
pinYin | |
strokeCount |
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
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for