PhpSpreadsheet Reader Example #07
Simple File Reader Loading a Single Named WorkSheet
';
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
echo 'Loading Sheet "',$sheetname,'" only
';
$reader->setLoadSheetsOnly($sheetname);
$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,'
';
}
?>