PhpSpreadsheet Reader Example #08
Simple File Reader Loading Several Named WorkSheets
';
$reader = IOFactory::createReader($inputFileType);
echo 'Loading Sheet',((count($sheetnames) == 1) ? '' : 's'),' "',implode('" and "', $sheetnames),'" only
';
$reader->setLoadSheetsOnly($sheetnames);
$spreadsheet = $reader->load($inputFileName);
echo '
';
echo $spreadsheet->getSheetCount(),' worksheet',(($spreadsheet->getSheetCount() == 1) ? '' : 's'),' loaded
';
$loadedSheetNames = $spreadsheet->getSheetNames();
foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) {
echo $sheetIndex,' -> ',$loadedSheetName,'
';
}
?>