How to convert .xls file which has html tags in it to delimited .csv from command line

1.2k Views Asked by At

We have a requirement to download the export from jira portal and insert this information to a table for some reporting. now the challenge is , the file downloaded from jira is in .xlx extension and has all the html links in it. when i use the xls2csv (catdoc software )and other converter tools over the command line they cant recognize the file format and not able to convert. I need this file to be converted as .csv file with some delimiter that way i can use sql loader to load it to a table. enter image description here

1

There are 1 best solutions below

7
On BEST ANSWER

If you have libreoffice installed on your system, running the following code on a bash terminal (as a normal user, not root - see the reason here) might help you:

libreoffice --invisible --convert-to csv my_file.xls

If you need this code to be run on a script that runs as root, it would still be possible to (safely) run this command if you run it as a "normal" user instead of root, such as:

su - myuser -c 'libreoffice --invisible --convert-to csv my_file.xls'

To find out who is the user who should be used to run the command above, one of the best options would be to use the logname command, such as:

myuser="$(logname 2>/dev/null)"