objPHPExcel = $objReader->load ( $inputFileName ); echo "type is: " . $inputFileType; } catch ( Exception $e ) { \Yii::error ( "failed to read xls" ); throw $e; } } /** * first sheet to array */ public function toArray( ) { $objPHPExcel = $this->objPHPExcel; $array = [ ]; // Get worksheet dimensions $sheet = $objPHPExcel->getActiveSheet(); //$highestColumn = $sheet->getHighestColumn(); $hr = $sheet->getHighestRow(); foreach ( $sheet->getRowIterator () as $row ) { $arrayRow = []; $cellIterator = $row->getCellIterator (); $cellIterator->setIterateOnlyExistingCells ( false ); // Loop all cells, even if it is not set foreach ( $cellIterator as $cell ) { $arrayRow [] = $cell->getCalculatedValue(); } $array[] = $arrayRow; } return $array; } }