20_Read_Xls.php 599 B

12345678910111213141516171819202122
  1. <?php
  2. use PhpOffice\PhpSpreadsheet\IOFactory;
  3. require __DIR__ . '/../Header.php';
  4. $spreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
  5. // Write temporary file
  6. $filename = $helper->getTemporaryFilename('xls');
  7. $writer = IOFactory::createWriter($spreadsheet, 'Xls');
  8. $callStartTime = microtime(true);
  9. $writer->save($filename);
  10. $helper->logWrite($writer, $filename, $callStartTime);
  11. // Read Xls file
  12. $callStartTime = microtime(true);
  13. $spreadsheet = IOFactory::load($filename);
  14. $helper->logRead('Xls', $filename, $callStartTime);
  15. // Save
  16. $helper->write($spreadsheet, __FILE__);