Other things to note in taking this approach, none of which will help you with the problem at hand:
- This will fail if any of the fields have a pipe symbol, escaped or not
- This will fail if any of the fields has embedded newline
- You might hit problems when the data is encoded. UTF-8 and UTF-16 are not always converted automatically in XLS or XLSX, so you might need code like from_to ($c, "utf-8", "ucs2"); $worksheet->write_unicode ($row, $col++, $c);. YMMV
- Dates and numerics might be a PITA unless *you* tell XLS or XLSX what the format is. 20150203, 02032015, or even 2015-03-02. I've seen XLS and XLSX being extremely stubborn in converting anything that XLS or XLS thinks to look like a US date to save as a US date, even if I tell it to be text. FWIW I NEVER want US dates. Either YYYYMMDD or DD-MM-YYYY is acceptable for me.
- Same for currency: Imagine you get an amount as € 2.000,00 and read that into a system which requires 2,000.00.
Enjoy, Have FUN! H.Merijn