visualizer
/
vendor
/
phpoffice
/
phpexcel
/
Documentation
/
Examples
/
Reader
/
exampleReader16.php
exampleReader16.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.1.1, at vendor/phpoffice/phpexcel/Documentation/Examples/Reader/exampleReader16.php
| 1 | <?php |
| 2 | |
| 3 | error_reporting(E_ALL); |
| 4 | set_time_limit(0); |
| 5 | |
| 6 | date_default_timezone_set('Europe/London'); |
| 7 | |
| 8 | ?> |
| 9 | <html> |
| 10 | <head> |
| 11 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 12 | |
| 13 | <title>PHPExcel Reader Example #16</title> |
| 14 | |
| 15 | </head> |
| 16 | <body> |
| 17 | |
| 18 | <h1>PHPExcel Reader Example #16</h1> |
| 19 | <h2>Handling Loader Exceptions using Try/Catch</h2> |
| 20 | <?php |
| 21 | |
| 22 | /** Include path **/ |
| 23 | set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/'); |
| 24 | |
| 25 | /** PHPExcel_IOFactory */ |
| 26 | include 'PHPExcel/IOFactory.php'; |
| 27 | |
| 28 | |
| 29 | $inputFileName = './sampleData/example_1.xls'; |
| 30 | echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />'; |
| 31 | try { |
| 32 | $objPHPExcel = PHPExcel_IOFactory::load($inputFileName); |
| 33 | } catch(PHPExcel_Reader_Exception $e) { |
| 34 | die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage()); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | echo '<hr />'; |
| 39 | |
| 40 | $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); |
| 41 | var_dump($sheetData); |
| 42 | |
| 43 | |
| 44 | ?> |
| 45 | <body> |
| 46 | </html> |