setReadDataOnly(TRUE);
$spreadsheet = $reader->load("test.xlsx");
$worksheet = $spreadsheet->getActiveSheet();
$file = $spreadsheet->getActiveSheet();
// $active_sheet = $file->getActiveSheet();
$chf='A';
$count=2;
//$cellValue = $file->getActiveSheet()->getCell($chf.$count+3)->getValue();
$cellValue = $worksheet->getActiveSheet()->getCell($chf.$count+3)->getValue();
echo $cellValue;
echo '
' . PHP_EOL;
foreach ($worksheet->getRowIterator() as $row) {
echo '' . PHP_EOL;
$cellIterator = $row->getCellIterator();
$cellIterator->setIterateOnlyExistingCells(FALSE); // This loops through all cells,
// even if a cell value is not set.
// For 'TRUE', we loop through cells
// only when their value is set.
// If this method is not called,
// the default value is 'false'.
foreach ($cellIterator as $cell) {
echo '' .
$cell->getValue() .
' | ' . PHP_EOL;
}
echo '
' . PHP_EOL;
}
echo '
' . PHP_EOL;
?>