How to convert xlsx files to xls or csv format on Linux

Last updated on September 19, 2020 by Dan Nanni

The xlsx file name extension is a new file format based on XML, first used by Microsoft Office Excel 2007 spreadsheet application. The letter x appended to the existing xls extension used by earlier versions of Excel, signifies that the format is based on XML. If you would like to open or edit an xlsx file created by Excel 2007 or later, on an earlier version of Excel or any other spreadsheet application, you need to convert xlsx files first.

There are four different ways you can convert xlsx files on Linux.

Method One: Gnumeric

The first method is to use Gnumeric. Gnumeric is a free spreadsheet program which can import or export data in different file formats such as csv, xls and xlsx. Gnumeric comes with a command-line utility called ssconvert which can convert between different spreadsheet file formats. In order to convert xls files to xlsx or csv format by using Gnumeric, first install Gnumeric. Once Gnumeric is installed, you can use ssconvert.

$ sudo apt-get install gnumeric

Note that ssconvert accepts arguments in the following format.

$ ssconvert --export-type=ID [input file] [output file]

In the above, --export-type is optional, and without --export-type, ssconvert can infer export type from the extension of output file. If you want to explicitly specify export type, ID can be one of the following.

So if you would like to convert xlsx files to csv format using ssconvert:

$ ssconvert input.xlsx output.csv
$ ssconvert --export-type=Gnumeric_stf:stf_csv input.xls output.txt

Method Two: xlsx2csv

The drawback of the Gnumeric-based method is that you need to install Gnumeric which may be too bloated software to install just for file conversion. A more lightweight way is to use xlsx2csv which is a python tool for xlsx to csv conversion.

$ git clone https://github.com/dilshod/xlsx2csv.git
$ cd xlsx2csv
$ ./xlsx2csv.py input.xlsx output.csv

Method Three: OpenOffice

Besides these methods, you can also use OpenOffice (if you already have it installed) to perform xlsx format conversions. OpenOffice comes with a command-line utility called unoconv which can convert xlsx files.

If you do not have it installed, you can install it with:

$ sudo apt-get install unoconv
$ unoconv -f csv input.xlsx

Note that once you install unoconv using apt-get, it will install OpenOffice package as well.

Method Four: Google Docs

The final method of converting xlsx files is to use Google Spreadsheets. Google Spreadsheets can import Excel 2007 files. Thus, all you have to do is to import your xlsx file on to Google Docs Spreadsheet, click on Download as menu, and choose an appropriate file format: Excel (xls), PDF, CSV, Text. Note that document files which can be uploaded to Google Docs for conversion cannot be larger than 2MB.

Support Xmodulo

This website is made possible by minimal ads and your gracious donation via PayPal or credit card

Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.

Xmodulo © 2021 ‒ AboutWrite for UsFeed ‒ Powered by DigitalOcean