07_Reader.php 539 B

12345678910111213141516171819
  1. <?php
  2. use PhpOffice\PhpSpreadsheet\IOFactory;
  3. use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  4. require __DIR__ . '/../Header.php';
  5. // Create temporary file that will be read
  6. $sampleSpreadsheet = require __DIR__ . '/../templates/sampleSpreadsheet.php';
  7. $filename = $helper->getTemporaryFilename();
  8. $writer = new Xlsx($sampleSpreadsheet);
  9. $writer->save($filename);
  10. $callStartTime = microtime(true);
  11. $spreadsheet = IOFactory::load($filename);
  12. $helper->logRead('Xlsx', $filename, $callStartTime);
  13. // Save
  14. $helper->write($spreadsheet, __FILE__);