Cyberithub

How to Install xls2csv on Ubuntu 20.04 LTS (Focal Fossa)

Advertisements

In this article, I will take you through the steps to install xls2csv on Ubuntu 20.04 LTS (Focal Fossa). xls2csv is a free and open source program which converts XLS files to CSV files. It's based on xls2csv.c of libxls. It comes with many features including converting CSV in the same way as Excel's "Save as CSV" that makes it suitable for the Job. It is also very easy to install on almost any Linux distribution. Here we will see the steps to install xls2csv on one such Linux distribution i.e on Ubuntu 20.04 LTS based systems.

 

How to Install xls2csv on Ubuntu 20.04 LTS (Focal Fossa)

How to Install xls2csv on Ubuntu 20.04 LTS (Focal Fossa)

Also Read: How to Install MySQL on Ubuntu 20.04 LTS (Focal Fossa)

Step 1: Prerequisites

a) You should have a running Linux System.

b) You should have sudo or root access to run privileged commands.

c) You should have a package manager available in your System.

 

Step 2: Update Your Server

Before installing any package, it is always recommended to update all the packages to the latest available stable version using sudo apt update && sudo apt upgrade command as shown below.

cyberithub@ubuntu:~$ sudo apt update && sudo apt upgrade
[sudo] password for cyberithub:
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 https://dl.google.com/linux/chrome/deb stable InRelease [1,811 B]
Hit:3 http://in.archive.ubuntu.com/ubuntu focal InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:5 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:6 https://dl.google.com/linux/chrome/deb stable/main amd64 Packages [1,093 B]
Get:7 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.7 kB]
Get:8 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [93.9 kB]
Get:9 http://in.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages [761 kB]
Get:10 http://security.ubuntu.com/ubuntu focal-security/universe amd64 c-n-f Metadata [16.8 kB]
Get:11 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [940 B]
Get:12 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [2,263 kB]
Get:13 http://in.archive.ubuntu.com/ubuntu focal-updates/main Translation-en [394 kB]
Get:14 http://in.archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [274 kB]
Get:15 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [1,457 kB]
Get:16 http://in.archive.ubuntu.com/ubuntu focal-updates/restricted Translation-en [206 kB]
Get:17 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,007 kB]
Get:18 http://in.archive.ubuntu.com/ubuntu focal-updates/universe i386 Packages [704 kB]
Get:19 http://in.archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [408 kB]
..................................................

 

Step 3: Install xls2csv

xls2csv utility is only available through catdoc package so to install this utility you need to install catdoc package from default Ubuntu repo by using sudo apt install catdoc command as shown below. This will install the package along with all its dependencies.

cyberithub@ubuntu:~$ sudo apt install catdoc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
Suggested packages:
tk | wish
The following NEW packages will be installed:
catdoc
0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded.
Need to get 88.5 kB of archives.
After this operation, 697 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu focal/universe amd64 catdoc amd64 1:0.95-4.1 [88.5 kB]
Fetched 88.5 kB in 34s (2,620 B/s)
Selecting previously unselected package catdoc.
(Reading database ... 184674 files and directories currently installed.)
Preparing to unpack .../catdoc_1%3a0.95-4.1_amd64.deb ...
Unpacking catdoc (1:0.95-4.1) ...
Setting up catdoc (1:0.95-4.1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...

 

Step 4: Verify Installation

After successful installation, you can verify the installed files by using dpkg -L catdoc command as shown below.

cyberithub@ubuntu:~$ dpkg -L catdoc
/.
/etc
/etc/catdocrc
/usr
/usr/bin
/usr/bin/catdoc
/usr/bin/catppt
/usr/bin/wordview
/usr/bin/xls2csv
/usr/lib
/usr/lib/mime
/usr/lib/mime/packages
/usr/lib/mime/packages/catdoc
/usr/share
/usr/share/catdoc
/usr/share/catdoc/8859-1.txt
/usr/share/catdoc/8859-10.txt
/usr/share/catdoc/8859-11.txt
/usr/share/catdoc/8859-13.txt
/usr/share/catdoc/8859-14.txt
/usr/share/catdoc/8859-15.txt
/usr/share/catdoc/8859-2.txt
/usr/share/catdoc/8859-3.txt
/usr/share/catdoc/8859-4.txt
...........................................

 

Step 5: Check Version

You can check the installed version by using xls2csv -V command as shown below.

cyberithub@ubuntu:~$ xls2csv -V
Catdoc Version 0.95

 

Step 6: Using xls2csv

Now that xls2csv utility is successfully installed in the System, it is time to test the utility by converting a xls file to csv format. Here we are using an example excel file called excel_example.xls to convert it to excel_example.csv using xls2csv -x excel_example.xls -s cp1252 -d 8859-1 > excel_example.csv command as shown below.

cyberithub@ubuntu:~$ xls2csv -x excel_example.xls -s cp1252 -d 8859-1 > excel_example.csv

-x : print unknown Unicode chars as \xNNNN, rather than as question marks

-s : specifies source charset

-d : specifies destination charset name

 

Step 7: Uninstall xls2csv

Once you are done with xls2csv utility, you can also choose to uninstall it from your System by using sudo apt remove catdoc command as shown below.

cyberithub@ubuntu:~$ sudo apt remove catdoc
[sudo] password for cyberithub:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libllvm11 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
catdoc
0 upgraded, 0 newly installed, 1 to remove and 24 not upgraded.
After this operation, 697 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 185807 files and directories currently installed.)
Removing catdoc (1:0.95-4.1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...

Leave a Comment