Using PHPExcel, I have an issue with the getHighestRow() function. If the spreadsheet is formatted beyond the last data entry, highest row does not reflect data entry but cells modification including formatting.
How can I have the number of useful rows, meaning only those where there is non empty data?
So far I using the following code as a substitute but I'm not happy with loading the entire first column:
$file = $fileForm->get('file')->getData();
$path = $file->getRealPath();
$phpExcel = $this->get('phpexcel')->createPHPExcelObject($path);
$worksheet = $phpExcel->getSheet();
$firstColumn = $worksheet->rangeToArray("A1:A" . $worksheet->getHighestRow(), null, false, false);
$firstColumn = array_map(function(Array $lines) {
return array_values($lines)[0];
}, $firstColumn);
$highestRow = count(array_filter($firstColumn));
unset($firstColumn);