I have a csv-like file with complicated data and would like to open it in LibreOffice Calc, Microsoft Excel, or another spreadsheet program.
What I mean by csv-like:
- Fields are separated by the ASCII unit separator
\037
/\x1F
/31 decimal (a regular csv would use,
). - Records are separated by the null byte
\0
(a regular csv would use\n
). - Fields contain nearly arbitrary data, for instance (unpaired) quotes (
"
,'
) and linebreaks (\r
,\n
, or both). There are no quoting mechanisms, therefore the field and record delimiters cannot be stored inside a field.
After conversion to a spreadsheet document, I want to keep all data exactly as in the input. If a field in the file contains a linebreak, quote,or any other special symbol the corresponding cell in the output should too. This implies that all cells in the resulting spreadsheet have to be formatted as text.
Preserving the original data is extremely important. Since the files are huge I cannot manually look into the results and decide whether the conversion was successful or the data was mangled.
Since the data is generated by a bash script it would be nice if that script could do the conversion too. Other automatic solutions are welcome. Conversion to a regular csv file would probably be possible using csv's quoting mechanisms, but is not an option unless there is a reliable one-click csv import in Calc or Excel. As far as I know, importing a csv file manually takes quite some time and is error prone (in Calc and Excel you have to manually specify the delimiters, quoting mechanisms, column data type = text. In newer Excel versions you also have to deal with unwanted Data Connections).
Is there a tool (like ssconvert
), or a simple script, or an option in Calc / Excel to
convert my csv-like file unmangled into any spreadsheet format (ods, odf, xls, xlxs)?