An Excel worksheet can be sorted in ascending or descending order, using VBScript.


Copy the below to a "Run VBScript" Action and replace the %ExcelPath% and %SheetName% variables accordingly.


Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("%ExcelPath%")
objExcel.Visible = True ' can set to False to not see it
Set objWorksheet = objWorkbook.Sheets("%SheetName%")
Set objRange = objWorksheet.UsedRange

set sortCol1 = objWorksheet.Range("A1")
set sortCol2 = objWorksheet.Range("B1")

'XlSortOrder Enum
'xlAscending    1   default. Sorts the specified field in ascending order.
'xlDescending   2   Sorts the specified field in descending order.
Const xlAscending = 1
Const xlDescending = 2

'==============================================================================
'XlYesNoGuess Enum
'xlGuess    0   Excel determines whether there’s a header, and to determine where it is, if there is one.
'xlNo       2   default. (The entire range should be sorted).
'xlYes      1   (The entire range should not be sorted).
Const xlGuess = 0
Const xlYes = 1
Const xlNo = 2

'expression.Sort (_Key1_, _Order1_, _Key2_, _Type_, _Order2_, _Key3_, _Order3_, _Header_, _OrderCustom_, _MatchCase_, _Orientation_, _SortMethod_, _DataOption1_, _DataOption2_, _DataOption3_)

objRange.Sort sortCol1, xlAscending, sortCol2, ,xlAscending, , , xlYes

objWorkbook.Save
objWorkbook.close
objExcel.quit