JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
872 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to sort in descending order the cells with a 'rose' background, as you can do in the 'filter' or 'custom sort' but with ExcelScript for web:
range.getSort().apply([ {
ascending: false,
key: 5,
sortOn: ExcelScript.SortOn.cellColor,
subField: "Rose"
}]);
But it does not work. I have tried to record a macro with either sorting cell color or font but the macro does not record the SortOn, instead it just shows:
selectedSheet.getRange("A8:K50").getSort().apply([{key: 0, ascending: true}], false, true);
Is there any way to sortOn cell color with ExcelScripts?