getActiveSheet()->getCell('B2')->setValue(''); $spreadsheet->getActiveSheet()->getCell('C1')->setValue('C1'); $spreadsheet->getActiveSheet()->getCell('C3')->setValue('C3'); $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format); $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); $reloadedSpreadsheet = $this->writeAndReload($spreadsheet, $format, function ($reader) { $reader->setReadEmptyCells(false); }); $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('B2')); $this->assertFalse($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C2')); $this->assertTrue($reloadedSpreadsheet->getActiveSheet()->getCellCollection()->has('C3')); } }