Reading a simple .xlsx not working unless i open and save the file first

Topics: Developer Forum
Jun 24, 2013 at 9:55 PM
Edited Jul 14, 2013 at 8:38 AM
I have a simple excel file that i downloaded from a web application that generates these files.
They show just fine when i open them in Excel 2013. However when i load them in my cakephp application with the code below, i get an empty result:
array(
    (int) 0 => array(
        (int) 0 => null
    )
)
However, if i open the .xlsx in Excel first and then save it. (I don't change any values or anything). The code works flawlessly with the saved file and i get exactly the results that i want:
array(
    (int) 0 => array(
        (int) 0 => 'Aa',
        (int) 1 => 'Bb',
        (int) 2 => '1',
        (int) 3 => '2',
        (int) 4 => '3',
        (int) 5 => '4',
        (int) 6 => '5'
    ), etc.
Unfortunately it's not practical for me to open and save all the files first before i load them in my web application so has anyone encountered this problem and knows what's going on?
        $objPHPExcel = PHPExcel_IOFactory::load('files/test.xlsx');
        $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, false, false, false);
        debug($sheetData);
PHP 5.4.7
PHPExcel 1.7.9
Coordinator
Jun 24, 2013 at 11:14 PM
Can you identify the application being used to generate this file? It's not using the documented OfficeOpenXML namespaces, so I'd need to add the overhead of namespace detection to be able to read it.
Jun 25, 2013 at 9:04 AM
Edited Jun 27, 2013 at 11:50 AM
MarkBaker wrote:
Can you identify the application being used to generate this file? It's not using the documented OfficeOpenXML namespaces, so I'd need to add the overhead of namespace detection to be able to read it.
Thank you for your time. The system is built with Silverlight. Can't really give you a direct link and I am not able to figure out what they actually use to generate the files.