visualizer
/
vendor
/
phpoffice
/
phpexcel
/
Documentation
/
Examples
/
Reader
/
exampleReader04.php
exampleReader04.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.1.1, at vendor/phpoffice/phpexcel/Documentation/Examples/Reader/exampleReader04.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 #04</title> |
| 14 | |
| 15 | </head> |
| 16 | <body> |
| 17 | |
| 18 | <h1>PHPExcel Reader Example #04</h1> |
| 19 | <h2>Simple File Reader using the PHPExcel_IOFactory to Identify a Reader to Use</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/example1.xls'; |
| 30 | |
| 31 | $inputFileType = PHPExcel_IOFactory::identify($inputFileName); |
| 32 | echo 'File ',pathinfo($inputFileName,PATHINFO_BASENAME),' has been identified as an ',$inputFileType,' file<br />'; |
| 33 | |
| 34 | echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with the identified reader type<br />'; |
| 35 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
| 36 | $objPHPExcel = $objReader->load($inputFileName); |
| 37 | |
| 38 | |
| 39 | echo '<hr />'; |
| 40 | |
| 41 | $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true); |
| 42 | var_dump($sheetData); |
| 43 | |
| 44 | |
| 45 | ?> |
| 46 | <body> |
| 47 | </html> |