Ask Your Question
0

unoconv: specify thousands separator when converting csv to xls [closed]

asked 2014-10-22 21:56:18 +0200

Mojo Dodo gravatar image

Hi,

I'm using unoconv to convert many csv-files to xls-documents. I'm working with Ubuntu as my operating system. My locale settings in LibreOffice are set to German --> LO and therefore unoconv uses a dot . as the thousands separator).

Is there a way to:

1) either specify the thousands separator when converting csv to xls. My command looks like this: unoconv -f xls -o ~/test/ ~/test/testfile.csv

2) or somehow change the locale setting to English (eg en_US) via command line (and afterwards back to German)

Having the German settings causes incorrect convertion for my csv-files (as for example 0.123 will be interpreted as 123)

Thanks already for any help!

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-06 02:08:29.101180

1 Answer

Sort by » oldest newest most voted
0

answered 2014-11-14 18:04:42 +0200

Nekksys gravatar image

updated 2014-11-14 19:15:44 +0200

You can work around this by enclosing your fields in double quotes. This should force unoconv to see the field as text rather than a number and keep leading zeroes intact.

There's also the "-i" option which can be used to alter field separator, text delimiter, encoding, starting row and column format. Some details can be found in the MAN page which can also be seen here:

http://linux.die.net/man/1/unoconv

The "-i" option should be used to adjust the colum format; specifically, the setting the column format to "10" will do exactly what you need. For example, issuing the following command:

unoconv -f xls -i 44,34,utf-8,2,1/5/2/1/3/1/4/10 -o ~/test/ ~/test/file.csv

will return a file where column 4 is formatted as expected, e.g. "," as the thousands separator and "." as the decimal place. Find more details here:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options

Hope this helps!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-22 21:56:18 +0200

Seen: 2,179 times

Last updated: Nov 14 '14