Unoconv: specify thousands separator when converting csv to xls


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!

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:

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:

Hope this helps!