Ask Your Question
0

CLI - convert ods to csv with semicolon as delimiter

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

Klau3 gravatar image

updated 2014-02-19 23:01:50 +0200

manj_k 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 close merge delete

4 answers

Sort by » oldest newest most voted
0

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

Comments

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
1

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
1

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
1

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
0

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
Select:
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

Comments

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
Login/Signup to Answer

Question Tools

2 followers

Stats

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

Seen: 6,141 times

Last updated: Feb 27