PhpSpreadsheet Reader Example #16

Handling Loader Exceptions using Try/Catch

'; try { $spreadsheet = IOFactory::load($inputFileName); } catch (InvalidArgumentException $e) { die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); } echo '
'; $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); var_dump($sheetData); ?>