0

I have a 3 column csv file. The 2nd column contains numbers with a leading zero. For example:

044934343

I need to convert a .csv file into a .xls and to do that I'm using the command line tool called 'unoconv'.

It's converting as expected, however when I load up the .xls in Excel instead of showing '04493434', the cell shows '4493434' (the leading 0 has been removed).

I have tried surrounding the number in the .csv file with a single quote and a double quote however the leading 0 is still removed after conversion.

Is there a way to tell unoconv that a particular column should be of a TEXT type? I've tried to read the man page of unocov however the options are little confusing.

Any help would be greatly appreciated.

enormace
  • 641
  • 2
  • 6
  • 20

1 Answers1

1

Perhaps I came too late at the scene, but just in case someone is looking for an answer for a similar question this is how to do:

unoconv -i FilterOptions=44,34,76,1,1/1/2/2/3/1 --format xls <csvFileName>

The key here is "1/1/2/2/3/1" part, which tells unoconv that the second column's type should be "TEXT", leaving the first and third as "Standard".

You can find more info here: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options#Token_7.2C_csv_import

BTW this is my first post here...

ksquarekr
  • 11
  • 1