How to convert xls file to csv via Linux command line

Libreoffice/Openoffice provides graphical utility to convert xls files to csv and vice versa. But its not practical while dealing with bulk list of files.
In such cases, we can use the program Gnumeric. The Gnumeric spreadsheet application comes with a commandline utility called ssconvert that can convert between a variety of spreadsheet formats on the commandline.

This program is available in the basic repository and we can install the same directly.

For Redhat based distributions,

#yum install gnumeric

For Debian bases distributions,

#apt-get install gnumeric

We can convert the xls files to csv using the following command.

#ssconvert file.xls file.csv

Note that we need to use one more option if the source file contains multiple sheets.

#ssconvert -S file.xls file.csv

So each sheet in the source file will be exported to separate csv files.

 

Leave a Reply

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