Ask Your Question
0

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

asked 2013-02-03 23:38:46 +0200

richardm gravatar image

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
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-05 18:49:29.965286

2 Answers

Sort by » oldest newest most voted
1

answered 2014-11-02 08:07:17 +0200

jobzombi gravatar image

updated 2014-11-02 08:13:30 +0200

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"
edit flag offensive delete link more

Comments

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...

Sadi gravatar imageSadi ( 2016-04-10 13:43:03 +0200 )edit
-1

answered 2013-02-27 18:54:54 +0200

qubit gravatar image

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!

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-03 23:38:46 +0200

Seen: 7,969 times

Last updated: Nov 02 '14