安装
composer require phpoffice/phpspreadsheet
示例
<?phprequire 'vendor/autoload.php';use PhpOffice\PhpSpreadsheet\Spreadsheet;use PhpOffice\PhpSpreadsheet\Writer\Xlsx;$spreadsheet = new Spreadsheet();$sheet = $spreadsheet->getActiveSheet();$sheet->setCellValue('A1', 'Hello World !');$writer = new Xlsx($spreadsheet);$writer->save('hello world.xlsx');