Skip to content

Instantly share code, notes, and snippets.

@IamSmith
Created April 4, 2011 19:12
Show Gist options
  • Save IamSmith/902216 to your computer and use it in GitHub Desktop.
Save IamSmith/902216 to your computer and use it in GitHub Desktop.
Output a PHPExcel file
<?php
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename=" ' . "Report" . '.xls"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment