The problem can be solved using the PHPExcel library:
$data = []; $type = PHPExcel_IOFactory::identify($filepath); $objReader = PHPExcel_IOFactory::createReader($type); $objPHPExcel = $objReader->load($filepath); $rowIterator = $objPHPExcel->getActiveSheet()->getRowIterator(); foreach($rowIterator as $row){ $cellIterator = $row->getCellIterator(); foreach ($cellIterator as $cell) { $data[$row->getRowIndex()][$cell->getColumn()] = $cell->getCalculatedValue(); } }
where $ filepath is the path to your xls or xlsx file.
ns16
source share