Answer the question
In order to leave comments, you need to log in
Problem saving .xlsx file via PHPExcel?
the bottom line is that in the script I load the file, change 3 values and save it to a new file.
BUT, firstly, it saves for a terribly long time, and secondly, a file that weighed 22KB becomes 2509KB.
here is a sample code:
$inputFileName = __DIR__.'\\files\\sample.xlsx';
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
}catch(Exception $Exception){
echo $Exception;
}
echo "File upload";
// Set the active sheet index
$objPHPExcel->setActiveSheetIndex(0);
// Get the active sheet
$sheet = $objPHPExcel->getActiveSheet();
$sheet->setTitle("New");
$sheet -> setCellValue('A6','2Nikita');
$sheet -> setCellValue('B6','2Hello');
$sheet -> setCellValue('C6', 'World2');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, "Excel2007");
try{
$objWriter->save(__DIR__.'\\files\\Test4.xlsx' );
}catch(Exception $Exception){
echo $Exception;
}
echo "file saved";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question