save(str_replace('.php', '.phpxl', __FILE__)); // Read PHPExcel Serialized file echo date('H:i:s') . " Read from PHPExcel Serialized format\n"; $objPHPExcel = PHPExcel_IOFactory::load(str_replace('.php', '.phpxl', __FILE__)); // Save Excel 2007 file echo date('H:i:s') . " Write to Excel2007 format\n"; $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save(str_replace('.php', '.xlsx', __FILE__)); // Echo memory peak usage echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n"; // Echo done echo date('H:i:s') . " Done writing file.\r\n";