Saving multiple workbooks

Topics: Developer Forum, User Forum
Jan 30, 2013 at 11:21 AM


Sorry if it's a question that's asked before. I'm wondering if it's possible to save multiple files at one time. 

I currently have this code:

for ($i = 0; $i < 4; $i++){
	$objPHPExcel = new PHPExcel();
	header("Content-Disposition: attachment;filename='$i.xls'");
	$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

but it only outputs 0.xls

Jan 30, 2013 at 11:50 AM

HTTP 101 - the answer is no; not when streaming output to a web browser, you can only send one file at a time; If you want to download multiple files in one go; then add them to a zip archive and then send the zip to the browser

Jan 30, 2013 at 11:53 AM

Oh okay, thanks for the reply!