CLI - convert ods to csv with semicolon as delimiter

I would like to know how to convert a spreadsheet .ods file to a semicolon separated .csv file using the command line.

That’s what I got so fare ↓ but couldn’t find any information about how to set the delimiter.

soffice --headless --convert-to csv test.ods
unoconv -e FilterOptions=59,34,0,1,1/5/2/1/3/1/4/1 -f csv test.ods

… a comma separated csv file is nearly useless.

unoconv -f csv -e FilterOptions="59,34,0,1" test.ods

Works fine!
tested using Mac OSX 10.10

This works also:

soffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":"59,ANSI,1" test.ods

Is there a way to mark which sheet number I want to convert when there is more then 1 sheet in document?

Bug fdo#36313 describes an enhancement (coming in v4.4) to the infilter argument that may assist in handling. The answer by @Mikeyy indicates a further option via an additional parameter to the --convert-to argument. It appears from another answer that the FilterOptions argument can also be used effectively.

Unoconv should allow the user to set the delimiter, but there seems to be a bug #161 (first number of the FilterOptions is the delimiter number in hex).

Ah, OK. Thus the “59” (decimal of the Unicode value for semi-colon) in your example. Thanks for reporting back.

Here is the LO bug #68786. I couldn’t find the “filters and storage” category in spreadsheet so I selected ‘FILTER’. Also I have no clue on how to mark it as enhancement bug. Lets see what the dev’s think about it.

Thanks. I have confirmed it and set the Severity to enhancement (you can’t do this via the BSA).

if you don’t stick to the conversion using the command line you can do the following:

Have your ods-file open
Save As > Text CSV (.csv) > Save
click: Use Text CSV Format
Character set: you need to select what suits your usage of the CSV file (I am using UFT-8)
Field delimiter: select >semicolon<
Text limiter: select what you need ( I keep it at >"<)
Check what you need for your application among the following next 4 checkboxes ( check only the first item)
Click: OK

In the same way you can create csv-file with comma, semicolon, colon, tab, and space as field delimiter and choose other elements needed for an application requiring a special csv-file format.

Doing stuff with the command line allows automatisation and thats the reason why I don’t want to use the UI.

I am aware that the command line is / might be faster, I never used it. I just wanted to give you a workaround

In this URL you could find an old list of filters to use in --convert-to extension:filter

I hope you like it:

In this URL is not included: --convert-to xlsx:“Calc MS Excel 2007 XML”

In my case works like a charm this way:

$ /opt/libreoffice4.4/program/soffice --nologo --headless --convert-to xlsx:“Calc MS Excel 2007 XML” file_exported.csv

Tuns soffice in the background converting a CSV file to Excel format; this command creates the Excel File: file_exported.xlsx in MS Excel 2007 format.

I hope this help.