Sort CSV
Description
Sort a CSV file by specifying a column for streamlined data organization and customized sorting.
Input Arguments
Input Argument | Type | Description | Required? | Advanced Option? | Default |
---|---|---|---|---|---|
CSV | String in CSV format | The CSV code or a file containing CSV | ✔️ | ❌ | - |
Sort column | String | Column to sort of by. Keep existing sort order by default. | ❌ | ❌ | - |
CSV has Headers? | Boolean | Indicates if the first row in the CSV contains column headers. | ❌ | ✔️ | Yes |
Auto-detect Field Types? | Boolean | Whether to automatically detect the data types of the CSV fields. | ❌ | ✔️ | No |
Number of Rows for Field Type Detection | Number | The number of rows to analyze for determining field data types (if auto-detection is enabled). | ❌ | ✔️ | 20 |
Remove Empty Rows? | Boolean | Whether to remove rows that have no data before converting. | ❌ | ✔️ | Yes |
Skip a Number of Rows | Number | Number of rows to skip from the start of the CSV before processing. | ❌ | ✔️ | 0 |
Stop at a specific Row | Number | Row number at which to stop reading the CSV. If not set, all rows will be processed. | ❌ | ✔️ | convert all rows |
Separator | String | The character used to separate fields in the CSV. If not set, the separator is auto-detected. | ❌ | ✔️ | Auto-detect separator |
Auto-detect Quote Delimiter? | Boolean | Whether to automatically detect the quote character used to enclose fields in the CSV. | ❌ | ✔️ | Yes |
Further sorting column | String | Further column to sort of by. Blank by default. | ❌ | ✔️ | - |
Reverse order? | Boolean | Whether to sort in descending (true) or ascending (false) order. | ❌ | ✔️ | No |
Output
Response | Type | Description |
---|---|---|
CSV Response | String in CSV format | The sorted CSV code |
Power Automate Examples
Sort CSV
We use a simple CSV with four pets.
Simple CSV with semicolon delimiter
Pet; Identifier;First name;Last name
Dog;1000;Eats;A Lot
Cat;1001;Likes;To Scratch
Cat;1002;Furry;Kitty
Duck;1003;Dagobert;Swimmy
We have not changed the advanced options and indicated the sort column.
In the advanced options, you can specify the sort column, indicate if the CSV has headers, enable automatic field type detection, set the number of rows for field type detection, remove empty rows, skip or stop at specific rows, define the separator, enable automatic quote delimiter detection, choose a further sorting column, and reverse the sort order.
💡
Looking for the response to this example? Scroll up to see the Output tab.
Known Limitations
⚠️
If you experienced other limitations please get in touch with us!