Marcos
Marcos

Reputation: 13

Convert .XLS TO CSV

I have an xls file which I want to convert to CSV with delimiter. ;

When I type this command from my repertoire

. xls for i in *; do libreoffice --headless --unaccept=accept-string --convert-to csv "$i"; done

it returns a file with the delimiter ","

example:

"foo", "tati" 

instead of

toto; tati

My question: is there no option for delimiter ; for libreoffice?

OS Debian 7.5

Thank you for your help.

Upvotes: 1

Views: 1706

Answers (2)

David C. Rankin
David C. Rankin

Reputation: 84541

Another option is to simply post-process your file with sed if you can't find a LibreOffice solution. For example if your datafile from the conversion is out.csv and it contains the quotes and commas you would like to remove and change to semi-colons, you can do:

sed -i 's/["]//g' out.csv    # strips all double-quotes
sed -i 's/[,]/;/g' out.csv  # convert all commas to semi-colons

Upvotes: 0

Nick Russo
Nick Russo

Reputation: 1542

If the answer turns out to be no, you can use tr to change commas into semi-colons, but this assumes that neither appears in your data itself, so it's not a general solution.

See this similar question on the libreoffice website:

http://ask.libreoffice.org/en/question/21916/cli-convert-ods-to-csv-with-semicolon-as-delimiter/

Upvotes: 1

Related Questions