How to lock an entire row after a particular column is edited.
Important notes:
* Neither the owner nor the user triggering the script lose permissions with this script
* You should always specify a trigger column or the row will lock after the first edit.
Previous
[ Ссылка ]
Sheet (to copy)
[ Ссылка ]
Script:
function onEdit(e){
const sh = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
if (e.range.columnStart != 4) return;
let protection = sh.getRange(e.range.rowStart,1,1,sh.getMaxColumns()).protect();
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.setDomainEdit(false);
}
}
![](https://s2.save4k.ru/pic/o06cKIVjnfM/mqdefault.jpg)