We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

CLI - convert ods to csv with semicolon as delimiter [closed]

asked 2013-08-28 20:54:16 +0200

Klau3 gravatar image

updated 2015-08-28 13:45:34 +0200

Alex Kemp gravatar image

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.

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-15 21:00:30.156011

5 Answers

Sort by » oldest newest most voted

answered 2013-08-29 04:53:20 +0200

oweng gravatar image

updated 2015-02-27 07:49:20 +0200

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.

edit flag offensive delete link more


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

Klau3 gravatar imageKlau3 ( 2013-08-29 10:54:39 +0200 )edit

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

oweng gravatar imageoweng ( 2013-08-30 02:07:46 +0200 )edit

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.

Klau3 gravatar imageKlau3 ( 2013-08-31 12:53:42 +0200 )edit

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

oweng gravatar imageoweng ( 2013-08-31 15:01:47 +0200 )edit

answered 2015-02-18 22:42:12 +0200

Mikeyy gravatar image

updated 2015-02-18 22:43:30 +0200

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?

edit flag offensive delete link more

answered 2014-10-16 11:34:46 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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

Works fine! tested using Mac OSX 10.10

edit flag offensive delete link more

answered 2015-10-29 02:18:31 +0200

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

I hope you like it: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options

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.

edit flag offensive delete link more

answered 2013-08-29 07:39:25 +0200

ROSt52 gravatar image

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.

edit flag offensive delete link more


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

Klau3 gravatar imageKlau3 ( 2013-08-29 10:47:03 +0200 )edit

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

ROSt52 gravatar imageROSt52 ( 2013-08-29 12:51:22 +0200 )edit

Question Tools



Asked: 2013-08-28 20:54:16 +0200

Seen: 22,635 times

Last updated: Oct 29 '15