我想對我的 Google 表格作業表或作業表中的多個標簽進行編碼,使其每天在特定時間自動鎖定并在每天特定時間解鎖。我也應該能夠編輯它,但不是我的合作者。
我該如何解決這個問題?
謝謝!
uj5u.com熱心網友回復:
有幾種方法可以繼續。最簡單的方法可能是添加和洗掉您的合作者
function myFunction() {
var ss = SpreadsheetApp.getActiveSpreadsheet()
//set the hours in which you want the document to be edited
var starttime = 8
var endtime = 18
//instead Europe/Berlin (your place)
var now = Utilities.formatDate(new Date(), "Europe/Berlin", "H")
//adds a collaborator
if (now >= starttime && now <= endtime){
ss.addEditor("[email protected]")
}
//removes a collaborator & optionally gives him viewing rights
else{
ss.removeEditor("[email protected]")
//ss.addViewer("[email protected]")
}
}
現在使用觸發器每小時運行一次您的代碼,它會自行完成其余的作業。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/344738.html
下一篇:重復記錄-洗掉陳述句不起作用
