I'm currently using PhpSpreadSheet Library and I wanna write into an existing spreadSheet. Is that possible?
If yes, how? I didn't see any possibility in the documentation.
Thanks!
Code:
<?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.xlsx');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With