Spout and undefined offset error during read of a xlsx file

20 Views Asked by At

I've a strange problem using SPOUT xlxs reader plugin. I get error

  Notice: Undefined offset: 19

In my test.xlsx at row 17. I don't know why. If I insert some text it is ok...but if it is empty I get error.....the strange thing is that all columns at index 19 before (1 <= row < 17) are empty but they doesn't get any error.

In attachment my test file: https://github.com/box/spout/files/4134401/test.zip

My code test:

include_once(dirname(dirname(__FILE__)) . "/vendors/spout/src/Spout/Autoloader/autoload.php");

use Box\Spout\Reader\Common\Creator\ReaderEntityFactory

$xlsx = ReaderEntityFactory::createReaderFromFile(dirname(__FILE__) . '/test.xlsx');

$xlsx->open(dirname(__FILE__) . '/test.xlsx');


foreach ($xlsx->getSheetIterator() as $sheet) {

    foreach ($sheet->getRowIterator() as $row) {

        $cells = $row->getCells();

        var_dump( $cells[18]->getValue() );
                var_dump( $cells[19]->getValue() ); //<---error offset 19 at row 17!!!!!!

    }

}
0

There are 0 best solutions below