![](/img/trans.png)
[英]Allow a temporary filter view on protected sheets and ranges google sheets?
[英]How to allow function in protected Google Sheets?
我正在使用下面的代碼來獲取B列中的最后更新日期。現在,當我保護B列時(因為我不希望其他用戶進行任何更改)並與其他用戶共享此工作表,因此不會發生更新。
多謝您的協助。
function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheetName = "Sheet1";
var s = SpreadsheetApp.getActiveSheet();
if (s.getName() !== sheetName) return;
var r = s.getActiveCell();
if( r.getColumn() != 2 ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "GMT+5", "dd/MM/yy, hh:mm:ss");
SpreadsheetApp.getActiveSheet().getRange('B' + row.toString()).setValue(time);
};
};
與其使用簡單的觸發器,不如使用可安裝的觸發器。
上面的原因是簡單的觸發器只能執行不需要授權的任務。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.