visualizer
/
vendor
/
phpoffice
/
phpexcel
/
Documentation
/
Examples
/
Reader
/
exampleReader17.php
exampleReader17.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.1.1, at vendor/phpoffice/phpexcel/Documentation/Examples/Reader/exampleReader17.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 #17</title> |
| 14 | |
| 15 | </head> |
| 16 | <body> |
| 17 | |
| 18 | <h1>PHPExcel Reader Example #17</h1> |
| 19 | <h2>Simple File Reader Loading Several Named WorkSheets</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 | $inputFileType = 'Excel5'; |
| 30 | // $inputFileType = 'Excel2007'; |
| 31 | // $inputFileType = 'Excel2003XML'; |
| 32 | // $inputFileType = 'OOCalc'; |
| 33 | // $inputFileType = 'Gnumeric'; |
| 34 | $inputFileName = './sampleData/example1.xls'; |
| 35 | |
| 36 | echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'<br />'; |
| 37 | $objReader = PHPExcel_IOFactory::createReader($inputFileType); |
| 38 | |
| 39 | |
| 40 | /** Read the list of Worksheet Names from the Workbook file **/ |
| 41 | echo 'Read the list of Worksheets in the WorkBook<br />'; |
| 42 | $worksheetNames = $objReader->listWorksheetNames($inputFileName); |
| 43 | |
| 44 | echo 'There are ',count($worksheetNames),' worksheet',((count($worksheetNames) == 1) ? '' : 's'),' in the workbook<br /><br />'; |
| 45 | foreach($worksheetNames as $worksheetName) { |
| 46 | echo $worksheetName,'<br />'; |
| 47 | } |
| 48 | |
| 49 | |
| 50 | ?> |
| 51 | <body> |
| 52 | </html> |