1

I'm writing a php web app to create and download an xlsx file, using Google App Engine:

$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheet(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 4);

header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="01simple.xls"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;

When I run this app locally, it creates and downloads a new xlsx file correctly, but it fails when deployed since Google App Engine currently does not support 'php://output' (feature request here)

'php://temp' and 'php://memory' are supported, but I'm not finding much documentation on how/if I can write and download a file using those options. Does anyone have a good solution to this problem?

Community
  • 1
  • 1
Zebbeni
  • 315
  • 2
  • 8
  • 1
    Most obvious answer would be to save to a temporary file, use readfile(), then delete the temporary file – Mark Baker Dec 11 '13 at 08:02
  • You could potentially write to GCS and remove the file afterwards. Or you could write to php://temp, then readfile('php://temp') – Mars Mar 13 '14 at 01:20

0 Answers0