Buy real YouTube subscribers. Best price and warranty.
Get Free YouTube Subscribers, Views and Likes

Google Sheets: Lock Entire Row After Edit

Follow
Spencer Farris

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
   • Google Sheets: Lock Cell After Edit  

Sheet (to copy)
https://docs.google.com/spreadsheets/...
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);
}
}

posted by nidantsqq