Using phpExcel to download xlsx file using Google App Engine

我们两清 提交于 2020-01-05 12:16:55

问题


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?

来源:https://stackoverflow.com/questions/20511385/using-phpexcel-to-download-xlsx-file-using-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!