我正在努力将excel内容附加到现有的excel文件中,并将其保存在具有不同名称的预定义目录中。我在我的应用程序中使用Laravel 5.4框架。
我使用以下代码创建excel文件并将其保存在指定位置:
$objPHPExcel = \PHPExcel_IOFactory::createReader('Excel2007');
//Load Existing excel file into I want to append
$objPHPExcel = $objPHPExcel->load(getDocumentPath().'/Report_Template_UG.xlsx');
$objPHPExcel->setActiveSheetIndex(0);
//Here I have Written code to insert my data into loaded excel file
$today = date('d-m-Y');
$time = date('H:i:s');
$filename = 'Report_'.$today.' '.$time.'.xlsx';
//welcomed is the root directory name of laravel project
$dir = 'C:\xampp\htdocs\welcomed\storage\documents\';
$filepath = $dir . $filename;
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save($path);
执行上面的代码时,我得到以下错误:
ErrorException in Excel2007.php line 377:
ZipArchive::close(): Renaming temporary file failed: Invalid argument
任何人都可以告诉我,我在上面的代码中做错了什么或者我错过了什么?
由于