PhpSpreadsheet/samples/20_Read_Xls.php

21 lines
604 B
PHP
Raw Normal View History

<?php
require __DIR__ . '/Header.php';
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
// Write temporary file
$filename = $helper->getTemporaryFilename('xls');
2016-10-06 11:49:41 +00:00
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
$callStartTime = microtime(true);
$writer->save($filename);
$helper->logWrite($writer, $filename, $callStartTime);
2016-10-06 11:49:41 +00:00
// Read Xls file
$callStartTime = microtime(true);
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
2016-10-06 11:49:41 +00:00
$helper->logRead('Xls', $filename, $callStartTime);
// Save
$helper->write($spreadsheet, __FILE__);