So I have a CSV that contains a filename and a file's contents. The file is full of newlines and all sorts of other characters. I need to have each row contain the filename in one column and the file contents in the next column, and then I need a new row, until the end of the file.
The data looks like this:
"filename.txt","hey there
buddy
how are you
doing"
"filename2.txt","and so on..."
According to http://creativyst.com/Doc/Articles/CSV/CSV01.htm#EmbedBRs, my CSV importer should read those line-breaky values as single values, not new rows. However, I have tried OO Calc, KSpread, Gnumeric, and even Microsoft Excel 2007 and none of them read it that way; they all consider each newline a new row.
Anyone know how to fix this? I've looked through other related questions but none of them seem to say.
If this doesn't work, I'll have to write the file directly with a Python Excel-writing module or something. Anyone know what to do here?
The file has to have a .csv extension. Doesn't seem to work otherwise. Bug in Excel as far as I'm concerned.
The free LumenWorks CSV reader handles newlines in the data if you set an appropriate flag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With