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
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:
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!