Sort Action: sort
The sort action under the CSVHandle function is used to sort the data in a CSV file based on a specified column. The data is sorted in ascending order by default. The sorted file is saved at the specified output path, and the operation’s result (true/false) is stored in the variable defined in the Element Key field.
Example: Suppose you have a CSV file, EmployeeRecords.csv, located at C:\Data. The file contains unsorted data as shown below:

You want to sort it by the “Department” column in ascending order and save the sorted file as SortedEmployeeRecords.csv.
Steps to Configure:
- Select Set a Variable Value from the Action dropdown.
- Enter a variable name in the Element Key field (e.g., SortStatus). This variable will store the result of the sorting operation (true/false).
- Click on Form, select Functions, and choose CSVHANDLE.
- In the Action field, select sort and provide the following parameters:
- FPath: Specify the path to the source CSV file (e.g., C:\Data\EmployeeRecords.csv).
- OutPath: Specify the path to save the sorted file (e.g., C:\Data\SortedEmployeeRecords.csv).
- ColumnName: Enter the column name to sort by (e.g., Department).
- Click Save.


Outcome on Execution:
- The action sorts the CSV data by the specified column (e.g., Department) ascending order:

- The sorted file is saved at the location specified in the OutPath parameter (e.g., SortedEmployeeRecords.csv).
- If the operation is successful, the variable (e.g., SortStatus) will store true. If the operation fails (e.g., incorrect file path or column name), the variable will store false.
- This variable can be referenced in subsequent steps using the syntax ${VariableName} (e.g., ${SortStatus}).