【发布时间】:2021-07-11 23:35:07
【问题描述】:
我有这个:
var sh = SpreadsheetApp.openById(ssID).getSheetByName('Sheet0');
var protection = sh.protect().setDescription('BVDATA');
var me = Session.getEffectiveUser();
protection.addEditor(me).setUnprotectedRanges([(sh.getRange(sh.getLastRow()+1, 6, sh.getLastRow(),1))]);
protection.removeEditors(protection.getEditors());
if (protection.canDomainEdit()){
protection.setDomainEdit(false);
}
}
我有一系列单元格,除 F2:F 外均受保护。此代码运行良好,它将自动保护除最后一行以外的所有 Sheet0。但我真正需要的是它只需要为已经输入内容OK(F) 的单元格启用保护,空白单元格和错误单元格仍然可以编辑。我需要如何对其进行编辑以使其按我的意愿工作。
【问题讨论】:
标签: google-apps-script google-sheets