44_Worksheet_info.php 734 B

1234567891011121314151617181920212223242526
  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. $inputFileType = IOFactory::identify($filename);
  11. $reader = IOFactory::createReader($inputFileType);
  12. $sheetList = $reader->listWorksheetNames($filename);
  13. $sheetInfo = $reader->listWorksheetInfo($filename);
  14. $helper->log('File Type:');
  15. var_dump($inputFileType);
  16. $helper->log('Worksheet Names:');
  17. var_dump($sheetList);
  18. $helper->log('Worksheet Names:');
  19. var_dump($sheetInfo);