Skip to content

Instantly share code, notes, and snippets.

@theredstapler
Created April 14, 2016 08:09
Show Gist options
  • Select an option

  • Save theredstapler/d15101f3f275a79823324dbba54d3949 to your computer and use it in GitHub Desktop.

Select an option

Save theredstapler/d15101f3f275a79823324dbba54d3949 to your computer and use it in GitHub Desktop.
<?php
require_once 'Classes/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'hello world!');
$objPHPExcel->getActiveSheet()->setTitle('Chesse1');
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="helloworld.xlsx"');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment