Home » excel » excel – Converting xls to semicolon delimited csv with soffice commandline

excel – Converting xls to semicolon delimited csv with soffice commandline

Posted by: admin April 23, 2020 Leave a comment

Questions:

I’m trying to convert xls files in a directory to csv format using soffice.

    soffice --headless --convert-to csv *

It is giving comma separated version(obviously). Now I want to get semi-colon delimited csv.

I thought of replacing commas with semi-colons using vim command.

    :%s/,/;/g

But it’s not correct, as it replaces commas which are kept intentionally in original content. It has to delimit while converting from xls to csv.

How to get semi-colon delimited csv with soffice command line?

How to&Answers:

Finally, I got an answer. Adding output_filter_options worked like a charm.

    --convert-to output_file_extension[:output_filter_name[:output_filter_options]] [--outdir output_dir] files

This wiki link helped. Here is what I did,

    soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":59,34,0,1,1 *.xls

NOTE: It works with libre office 4.3 or higher version.