PHPExcel: not getting correct values for getHighestRow() and getHighestColumn()

Topics: Developer Forum, User Forum
Sep 12, 2013 at 7:08 AM
I am using code.
$objPHPExcel = PHPExcel_IOFactory::load('images/product-excelsheets/store- products.xls');
    foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
        $worksheetTitle = $worksheet->getTitle();
        $highestRow = $worksheet->getHighestRow(); // e.g. 10
        $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
        $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
        $nrColumns = ord($highestColumn) - 64;
for ($row = 1; $row <= $highestRow; ++$row) {
            for ($col = 0; $col < $highestColumnIndex; ++$col) {
$val = $worksheet->getCellByColumnAndRow($col, $row)->getValue();
echo $val;
}
}
}
Sep 13, 2013 at 11:04 AM
What are the expected values, what are the values?
See if the getHighestDataRow() and getHighestDataColumn() methods give you more appropriate results.