Answer the question
In order to leave comments, you need to log in
How to make a scheduled export of an excel file to the server?
Hello.
I use PHPOffice / PhpSpreadsheet to generate excel, everything works, by pressing the "export" button, I save the file where it is convenient for me. There was a need to save it on the server according to the schedule, for example, at the beginning of each month, I can’t figure out how to do this. Who can faced such task?
Now I save like this:
...
$writer = new Xlsx($spreadsheet);
$filename = 'name.xlsx';
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'. $filename .'.xlsx"');
header('Cache-Control: max-age=0');
$writer->save($filename);
exit;
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