Ignore empty cells PHPExcel

If your problem is in getting empty columns that go after real data, and you would like to avoid these, you could do something like this:

$maxCell = $sheet->getHighestRowAndColumn();
$data = $sheet->rangeToArray('A1:' . $maxCell['column'] . $maxCell['row']);

This will return array representing only the area containing real data.

Leave a Comment