I want to lock certain column to prevent user edit the data of the column. Is Maatwebsite/Laravel-Excel provide this feature ?
What I have tried,
$sheet->setFreeze('A2');
But, it doesn't work. Is my method wrong ?
I have used setFreeze()
method but it doesn't work for my case as well.
I have thought this problem in different way and here is the way,
Here is the code.
$sheet->loadView('template');
$sheet->getProtection()->setPassword('password');
$sheet->getProtection()->setSheet(true);
Now unprotect the areas,
$sheet->getStyle('B1:D100')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
Column A will be protected already since whole sheet is protected, so remove protection from column B to last column.
In this case rectangular area from B1 to D100 will be editable. You can customize according to your requirement.
Hope you understand.