PhpSpreadsheet Reader Example #09

Simple File Reader Using a Read Filter

= 1 && $row <= 7) { if (in_array($column, range('A', 'E'))) { return true; } } return false; } } $filterSubset = new MyReadFilter(); echo 'Loading file ',pathinfo($inputFileName, PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
'; $reader = IOFactory::createReader($inputFileType); echo 'Loading Sheet "',$sheetname,'" only
'; $reader->setLoadSheetsOnly($sheetname); echo 'Loading Sheet using filter
'; $reader->setReadFilter($filterSubset); $spreadsheet = $reader->load($inputFileName); echo '
'; $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); var_dump($sheetData); ?>