📌  相关文章
📜  用户在编辑受保护范围上使用时的谷歌应用脚本 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:53.194000             🧑  作者: Mango

代码示例1
/ Remove all range protections in the spreadsheet that the user has permission to edit.
var ss = SpreadsheetApp.getActive();
var protections = ss.getProtections(SpreadsheetApp.ProtectionType.RANGE);
for (var i = 0; i < protections.length; i++) {
  var protection = protections[i];
  if (protection.canEdit()) {
    protection.remove();
  }
}