excel to csv, no output for less than 2 characters

Topics: Developer Forum, User Forum
Sep 26, 2010 at 8:42 PM

I use this code to transform an excel-file to csv:

    $reader = PHPExcel_IOFactory::createReader('Excel5');
    $excel = $reader->load('datei.xls');
    $writer = PHPExcel_IOFactory::createWriter($excel, 'CSV');

As long as all values are longer than 1 character it works fine.

If the excel-value is like "U" or "X" the result is "" (empty)

If the excel-value is "F4" or "HL1" the result comes correct as "F4" ...

So what can I do t receive single charater values in csv?

Sorry if this is a stupid question, but I spent already hours in searching for a solution



Sep 26, 2010 at 9:02 PM
Edited Sep 26, 2010 at 9:04 PM

Suspect that this may be related to Work items 14233 and 14260. This problem has been fixed in the latest SVN code, can you try again with that; or apply gorfou's fix as described in those work items.

Sep 26, 2010 at 9:24 PM

Hi Mark,

first, thanks for the quick answer, 20 minutes that's really amazing!

second, "item 14233" was the magic hint...


The only change is line 306
if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
if (!@iconv_substr('A', 0, 1, 'UTF-8')) {


now all works fine!

Thanks a lot

best regards