Home Linux Commandline Tools How to Convert xlsx to CSV Format in Linux

How to Convert xlsx to CSV Format in Linux

The windows-based Microsoft Excel application is known for its indisputable open XML spreadsheet files support. This same support also extends to XLSX file formats.

As you adapt or migrate to the Linux operating system environment, you will find the use of CSV or Comma-Separated file format a lot more convenient due to some of the following prime reasons:

  • Its adaptation to any text editor.
  • Its support by most database-oriented applications.
  • It is easily manipulated.
  • It is easily parsable.

A more practical scenario is using the CSV file format to quickly populate an application’s database. In this case, if your targeted data is in XLSX format, you will need to find a way of converting it to CSV before uploading the targeted file data to your database application.

This article will familiarize you with several approaches to achieving its objective.

How to Convert xlsx to CSV Using Gnumeric Tool in Linux

The GNOME-based nature of the Gnumeric application toolkit enables it to mirror basic Excel features like data imports and exports related to CSV, LaTex, OpenDocument, and HTML, among other formats.

Install Gnumeric in Linux

You can install Gnumeric on your Linux operating system distribution environment from either of the following commands:

$ sudo apt-get install gnumeric     [On Debian, Ubuntu and Mint]
$ sudo yum install gnumeric         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/gnumeric  [On Gentoo Linux]
$ sudo pacman -S gnumeric           [On Arch Linux]
$ sudo zypper install gnumeric      [On OpenSUSE]    

Gnumeric application toolkit references its ssconvert command to successfully convert an XLSX formatted file to a CSV formatted file.

Converting XLSX to CSV Using Gnumeric

Consider the following XLSX file sample:

XLSX File in Linux
XLSX File in Linux

To convert it to CSV with Gnumeric spreadsheet program, we would implement the following command:

$ ssconvert --export-type=Gnumeric_stf:stf_csv file_example.xlsx gnumeric_converted.csv 
$ cat gnumeric_converted.csv

The cat command should display the resulting CSV file on your Linux terminal.

List CSV File Content
List CSV File Content

CVS files content can be displayed on the Linux terminal through the cat command whereas XLSX files cannot be displayed hence the output from the above screen capture.

How to Convert xlsx to CSV Using xlsx2csv Converter

The xlsx2csv command is an XLSX to CSV file converter is a Python-based application. You can install it on your Linux operating system distribution environment from either of the following commands:

Install xlsx2csv in Linux

$ sudo apt-get install xlsx2csv     [On Debian, Ubuntu and Mint]
$ sudo yum install xlsx2csv         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/xlsx2csv  [On Gentoo Linux]
$ sudo pacman -S xlsx2csv           [On Arch Linux]
$ sudo zypper install xlsx2csv      [On OpenSUSE]    

Converting XLSX to CSV Using xlsx2csv Converter

To use it on our sample XLSX file, we would implement the command in the following manner:

$ xlsx2csv file_example.xlsx > xlsx2csv_converted.csv
Convert XLXS to CSV in Linux
Convert XLXS to CSV in Linux

Using the cat command, we are able to output the content of the resulting CSV file on our Linux terminal.

$ cat xlsx2csv_converted.csv
View CSV File Content
View CSV File Content

How to Convert xlsx to CSV Using csvkit Tool

The csvkit command is an XLSX to CSV converter toolkit that is also from a Python-based library. It is user-friendly and light in performance and can be installed on your Linux operating system distribution environment from either of the following commands:

Install csvkit in Linux

$ sudo apt-get install csvkit     [On Debian, Ubuntu and Mint]
$ sudo yum install csvkit         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/csvkit  [On Gentoo Linux]
$ sudo pacman -S csvkit           [On Arch Linux]
$ sudo zypper install csvkit      [On OpenSUSE]    

Converting XLSX to CSV Using csvkit Command

To convert a file from XLSX to CSV format with csvkit, we will use its in2csv command as demonstrated below.

$ in2csv file_example.xlsx > csvkit_converted.csv
$ cat csvkit_converted.csv

With these three approaches of converting XLSX files to CSV file formats, you should find one that makes your Linux computing experience comfortable enough.

You can explore more usage options of these XLSX to CSV conversion tools through their man pages:

$ man ssconvert 
$ man xlsx2csv
$ man in2csv

A recommendation preference would be the xlsx2csv toolkit due to its association with fewer conversion warnings.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.