Batch Converting Excel Files to CSV Using LibreOffice

I use LibreOffice Calc for working with CSV files. In my experience, it has the best support for CSV file formats, and it’s extremely fast. You can also use LibreOffice from the command line to run batch operations, such as converting Excel files to CSV format.

I use a Mac, so LibreOffice is installed in an app bundle. The command-line program that you will need to use is within the bundle. I’m assuming that LibreOffice is installed in the standard /Applications directory for this tutorial.

It’s important to note that you need to ensure that LibreOffice is not running when you execute this command. Otherwise, it will fail silently. This includes having the application open with no open windows. If you command+tab and see the application icon, you will need to tab to it and quit it fully.

The above command will convert all “.xlsx” files on your desktop to CSV files and will place them in a “csv” directory on your desktop. This approach is much easier than opening each one and doing an export, and can be used in test scripts when programmatically checking output.

Leave a comment

Your email address will not be published. Required fields are marked *