If you’re into scripting, you could accomplish this fairly simply in the pre-processor, I’m sure.
However, if you prefer not to script, I can think of another way to accomplish this. Open it as a database.
Now, this could be done in the datamapper itself if you wish, just be sure to install the 64bit Access Database Engine redistributable from Microsoft. Unfortunately, in it’s current iteration, your options for dynamic ODBC connections are limited in the datamapper, though I hear good things are planned to spruce this up in the next version. Still, a simple static query could do the job here:
SELECT * FROM ‘unsorted data.csv’ ORDER BY OrderName
When doing it this way, you’d just need to be certain that your data file is always named the same way and stored in the same location. Easily done with the workflow.
Alternatively, the workflow itself has a Database Query plugin which would allow you to read the CSV, sort it, and output a new sorted CSV file. This amounts to the same thing, but with the added benefit of being able to make the query dynamic (ie, point to a different file name).
Now, I should say, this will work on a small scale, but I have my doubts about how well it would scale up. Ultimately, I believe you’d want to resort the data via the preprocessor itself. I imagine the easiest way to go about it would be to convert the CSV file into an array, sort it with array sorting methods (https://www.w3schools.com/js/js_array_sort.asp), and then write it back to CSV.