saving xls as csv with libreoffice calc

I am using LibreOffice 3.5.7.2 Build ID: 350m1(Build:2) and would like to run LibreOffice calc from the terminal to open an .xls document and output to .csv. I can do this via the GUI by just opening the xls file and saving as csv and specifying the delimeter, but I would like to be able to do it via the terminal.

Research I've done:

when I run

> man libreoffice

I get:

SYNOPSIS
       libreoffice  [--accept=accept-string]  [--base]  [--calc] [--convert-to
       output_file_extension[:output_filter_name]

which has a command --convert-to output but I am not exactly sure how an example of that would look, I tried:

libreoffice --convert-to csv:writer_csv_Export --outdir /Data/ *.xls

as https://help.libreoffice.org/Common/Starting_the_Software_With_Parameters/vi mentions but it is not working.


libreoffice --headless --convert-to csv --outdir somedir *.xls appears to work.

--headless stops Libreoffice from opening a window, so it just converts your files and then exits.

:writer_csv_Export after csv appears to be unnecessary.

It might also be a problem that /Data/ means a directory called Data at the filesystem root, not in your home directory. Just omit --outdir DIR and you'll get the output in the current directory.

Note:

Close your xls/xlsx file before you run this command. If file is opened this command does not work.