getTemporaryFilename(); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Excel2007($sampleSpreadsheet); $writer->save($filename); $callStartTime = microtime(true); $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename); $helper->logRead('Excel2007', $filename, $callStartTime); // Save $helper->write($spreadsheet, __FILE__);