'); date_default_timezone_set('Europe/London'); /** Include PHPExcel */ require_once dirname(__FILE__) . '/../src/Bootstrap.php'; if (!file_exists("05featuredemo.xlsx")) { exit("Please run 05featuredemo.php first." . EOL); } echo date('H:i:s') , " Load from Excel2007 file" , EOL; $objReader = \PHPExcel\IOFactory::createReader('Excel2007'); $objPHPExcel = $objReader->load("05featuredemo.xlsx"); echo date('H:i:s') , " Iterate worksheets" , EOL; foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { echo 'Worksheet - ' , $worksheet->getTitle() , EOL; foreach ($worksheet->getRowIterator() as $row) { echo ' Row number - ' , $row->getRowIndex() , EOL; $cellIterator = $row->getCellIterator(); $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set foreach ($cellIterator as $cell) { if (!is_null($cell)) { echo ' Cell - ' , $cell->getCoordinate() , ' - ' , $cell->getCalculatedValue() , EOL; } } } } // Echo memory peak usage echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 1024 / 1024) , " MB" , EOL;