Is it possible to specify CSV filter options on the command line?

When converting a file to CSV using the command line (as below), is it possible to specify options (as specified here) for the CSV filter?

soffice --convert-to csv:"Text - txt - csv (StarCalc)" foo.xls

You can add options. I’m using LO 4.3.2.2 and the convert-to has the following syntax:

–convert-to output_file_extension[:output_filter_name[:output_filter_options]] [–outdir ouput_dir] files

In the case of converting to csv from xls, like I had to, you would do:

-convert-to csv:"Text - text - csv (StarCalc)":#,#,#,#,# [-outdir ouput_dir] files

The option syntax is found here:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options

The filter option has 5 tokens separated by commas. You HAVE to use all 5 or none. I know semi-colons are 59, so I tried just:

…(StarCalc)":59 -outdir…

and that did not work. If you are not sure what to use for the fifth token, just put a “1”, no need for “1/1” or anything like that. I used 59,34,0,1,1 and that worked just fine.

So for me:

"C:\Program Files (x86)\LibreOffice 4\program\scalc.exe" -convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 -outdir "C:\somepath\" "C:\anotherpath\File.xls"

It’s amazing, even works with LO 5.1.2 (under Ubuntu) except that (apart from starting the command simply with libreoffice --headless) it ignores the output dir, and insists on saving the new file in the current dir only – no problem though…

Hi @richardm,

I don’t believe that it’s possible to specify CSV filter options on the command line when using the “--convert-to” switch.

That being said, I believe that there are alternatives:

  • People have mentioned using macros and scripting to interface with the filters in LO
  • Try unoconv

Please also feel free to file an enhancement bug and ask for the command-line interface to support these options. Don’t forget to mark your bug as an ‘enhancement’. The QA team will be happy to help you triage your feature request in the bugtracker.

Please post a link to any bugs you file in a comment below using the format “fdo#123456”.

Thanks!