Hi,
same with excel, can get it to readonly, but not password protect to open:
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("$infile");
$spreadsheet->getSecurity()->setRevisionsPassword("$encryption_key", false);
$spreadsheet->getSecurity()->setWorkbookPassword("$encryption_key", false);
$spreadsheet->getSecurity()->setLockWindows(true);
$spreadsheet->getSecurity()->setLockStructure(true);
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet);
$writer->save("$infile");
thanks,