PHPExcel Reader Example #16

Handling Loader Exceptions using Try/Catch

'; try { $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); } catch (\PHPExcel\Reader\Exception $e) { die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } echo '
'; $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true); var_dump($sheetData); ?>