Protect approved rows
function protectApprovedRows() {
var ss=SpreadsheetApp.getActive();
var sh=ss.getSheetByName('name');
var sr=2;
var sc=1;
var vs=sh.getRange(sr,sc,sh.getLastRow()-sr+1,sh.getLastColumn()-sc+1).getValues();
var me = Session.getEffectiveUser();
vs.forEach(function(r,i){
if(r[4]=="Approved") {
var protection=sh.getRange(i+sr,sc,1,sh.getLastColumn()-sc+1).protect();
protection.addEditor(me);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()) {
protection.setDomainEdit(false);
}
}
});
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.