question

Wolfeius-1722 avatar image
0 Votes"
Wolfeius-1722 asked YutaoHuang-MSFT commented

How to sortOn cell color with ExcelScript?

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?

office-scripts-excel-devoffice-js-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FYI, this seems to be already addressed here: https://stackoverflow.com/a/71774713/6656547.

0 Votes 0 ·

0 Answers