答案 0 :(得分:4)
代码:
<?php
//load spreadsheet
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("yourspreadsheet.xlsx");
//change it
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'New Value');
//write it again to Filesystem with the same name (=replace)
$writer = new Xlsx($spreadsheet);
$writer->save('yourspreadsheet.xls');