For God so loved the world, that He gave His only begotten Son, that all who believe in Him should not perish but have everlasting life
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
778 B

  1. # PHPExcel User Documentation – Reading Spreadsheet Files
  2. ## Error Handling
  3. Of course, you should always apply some error handling to your scripts as well. PHPExcel throws exceptions, so you can wrap all your code that accesses the library methods within Try/Catch blocks to trap for any problems that are encountered, and deal with them in an appropriate manner.
  4. The PHPExcel Readers throw a PHPExcel_Reader_Exception.
  5. ```php
  6. $inputFileName = './sampleData/example-1.xls';
  7. try {
  8. /** Load $inputFileName to a PHPExcel Object **/
  9. $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
  10. } catch(PHPExcel_Reader_Exception $e) {
  11. die('Error loading file: '.$e->getMessage());
  12. }
  13. ```
  14. > See Examples/Reader/exampleReader16.php for a working example of this code.