Sort Action: sort
The sort action allows you to organize data within a specified column on an Excel sheet in ascending or descending order. This is especially useful for structuring and analyzing data in sheets effectively.
Note: Ensure that the file being used is not open during the execution of the Case to avoid errors or conflicts.
Example: You need to sort sales data in the SalesData.xlsx file by the Amount column on the first sheet in descending order.
Steps to Configure:
- Add a new step.
- Select Set a Variable Value from the Action dropdown.
- Enter a variable name in the Element Key field (e.g., SortedData). This variable will store the sorted file path.
- Click on Form, select Functions, and choose EXCEL Handler Functions from the dropdown.
- In the Cmd field, select sort and provide the following parameters:
- FPath: Enter the full path of the Excel file to be sorted (e.g., C:\Reports\SalesData.xlsx).
- Column Name: Specify the column in the sheet to sort (e.g., Amount).
- Sheet Number: Enter the sheet number containing the data to sort (e.g., 1).
- Sheet Name: Specify the name of the sheet containing the data (e.g., SalesReport).
- Order By: Choose the sorting order—asc for ascending or des for descending.
- Click Save.


Outcome on execution:
- The action sorts the Amount column in the sheet named SalesReport within SalesData.xlsx in descending order.
- The data is stored in the variable defined in the Element Key field for use in subsequent steps.
- This variable can be referenced in subsequent steps of the automation process using the syntax ${VariableName} (e.g., ${SortedData}).