PHPExcelを使ってみよう

github: https://github.com/PHPOffice/PHPExcel

なんか古そうだかDLしてみる
$ git clone https://github.com/PHPOffice/PHPExcel.git

<?php

require_once './PHPExcel/Classes/PHPExcel.php';

$objBook = new PHPExcel();

$objSheet = $objBook->getActiveSheet();

$objSheet->setCellValue('A1', 'ABCDEFG');
$objSheet->setCellValue('A2', 123.56);
$objSheet->setCellValue('A3', TRUE);
$objSheet->setCellValue('A4', '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))');
$objWriter = PHPExcel_IOFactory::createWriter($objBook, "Excel2007");
$objWriter->save('test.xlsx');
exit();
?>

$ sudo apt-get install php-zip

うん、OK