Convert csv to xls

I want convert report.csv file to report.xls with bash script.
csv file have pip delimiters.

FYI: I read about ssconvert but seems does not support delimiter option, mess up xls file.
Is there any other idea?


this man ssconvert seem to have option:

              The string used to separate fields. Defaults to space.

with example:

ssconvert -O 'separator=; format=raw' samples/excel/statfuns.xls statfuns.txt

btw, what's pip delimiters?

each csv file have separator like tab, semicolon,..,
This file use pip “|” as separate each columns.

ok, it's probably pipe (not pip).
Does the previous reply help?

Give me this error
Unable to guess exporter to use for 'file:///tmp/report.csv'.
Try --list-exporters to see a list of possibilities.

I'm no expert in ssconvert - you'll need to go over the quoted man pages and figure out what's missing,

This work for me

tr '|' '\t' <report.csv | ssconvert fd://0 report.xls

why do you need tr if you can specify optional delimiter?
hopefully you don't have pipes embedded into the quoted fields...
But whatever makes you happy :wink:

Not work as expected then i try tr.

I see - that makes lots of sense.
Good luck!

1 Like