Can I read and write an xlsm file with PHPSpreadsheet i did it with xlsx files.
this is my code
<?php
require 'vendor/autoload.php';
$inputFileName = 'excels/file.xlsm';
/** Load $inputFileName to a Spreadsheet object **/
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
//get first sheet in the workbook
$inputSheet = $spreadsheet->getSheet(0);
//Edit cell D4 with number 10 on first sheet
$inputSheet->setCellValue('D4', 10);
//Save file as result.xls
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$newFileName = time();
$writer->save("excels/$newFileName.xlsm");
?>
No, I'm afraid you can't; PHPSPreadsheet doesn't support xlsm format for reading or for writing, although it is capable of reading some xlsm files