Forum Discussion
TaurusGear13
Mar 13, 2025Copper Contributor
Office Scripts Custom Sort Failing During Automation
I am attempting to use office scripts within a OneDrive Excel document within Microsoft Teams to run a custom sort. Using the "Record Action" feature, I simply attempted to sort the range H3:J28 via ...
- Mar 13, 2025
Please try
function main(workbook: ExcelScript.Workbook) { const sheet = workbook.getActiveWorksheet() const range = sheet.getRange("H3:J28") const rangeSort: ExcelScript.SortField = { ascending: true, key: 0, sortOn: ExcelScript.SortOn.value } range.getSort().apply( [rangeSort], false, // case insensitive false, // no headers ExcelScript.SortOrientation.rows ) }
TaurusGear13
Mar 14, 2025Copper Contributor
Worked like a charm, than you! I am much more familiar with Excel VBA and the Office Scripts language has been a struggle for me.
SergeiBaklan
Mar 15, 2025Diamond Contributor
You are welcome