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.

46 lines
1.1 KiB

  1. <?php
  2. error_reporting(E_ALL);
  3. set_time_limit(0);
  4. date_default_timezone_set('Europe/London');
  5. ?>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>PHPExcel Reader Example #04</title>
  10. </head>
  11. <body>
  12. <h1>PHPExcel Reader Example #04</h1>
  13. <h2>Simple File Reader using the PHPExcel_IOFactory to Identify a Reader to Use</h2>
  14. <?php
  15. /** Include path **/
  16. set_include_path(get_include_path() . PATH_SEPARATOR . '../../../Classes/');
  17. /** PHPExcel_IOFactory */
  18. include 'PHPExcel/IOFactory.php';
  19. $inputFileName = './sampleData/example1.xls';
  20. $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
  21. echo 'File ',pathinfo($inputFileName,PATHINFO_BASENAME),' has been identified as an ',$inputFileType,' file<br />';
  22. echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with the identified reader type<br />';
  23. $objReader = PHPExcel_IOFactory::createReader($inputFileType);
  24. $objPHPExcel = $objReader->load($inputFileName);
  25. echo '<hr />';
  26. $sheetData = $objPHPExcel->getActiveSheet()->toArray(null,true,true,true);
  27. var_dump($sheetData);
  28. ?>
  29. <body>
  30. </html>