[英]Apps script export data to another spreadsheet, build it in xlsx and attach it to email
[英]Apps Script to Build a Data Protection and only allow Spreadsheet Owner to edit
我正在尋找構建一個腳本,該腳本將在用戶電子表格中創建一個受保護的范圍。 該腳本將從非所有者運行,基本上會將它們鎖定在特定范圍內(最終將綁定到 OnEdit 中)。
最終目標是:
當用戶編輯特定單元格時,該行現在將不再能夠被除所有者之外的任何人編輯,並且只能由所有者編輯。
我現在專注於弄清楚權限。
我創建的腳本創建了受保護的范圍,但將權限規則設置為“您和電子表格所有者”。
用戶應該不再能夠編輯。 我嘗試將保護警告設置為 false,但仍然允許用戶進行編輯。
用戶正在觸發腳本,但不是電子表格所有者。 我如何建立一個保護范圍來刪除他們在特定范圍內的編輯權限?
function RemovePermission() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
// /
// Define the data range that you want to protect
var range = sheet.getRange("b13:f13");
// Protect the range
var protection = range.protect().setDescription("Protected data range");
// Set the spreadsheet owner as the only editor
var editors = protection.getEditors();
for (var i = 0; i < editors.length; i++) {
protection.removeEditor(editors[i]);
}
protection.addEditor("enter owner email");
// Enable warning when editing
protection.setWarningOnly(true);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.