【发布时间】:2021-03-17 21:45:10
【问题描述】:
我有一个对 G Suite 用户运行良好的考勤系统(执行时间为 30 分钟),但我想让它为所有 gmail 用户运行(执行时间为 6 分钟)。当老师在我的 Google 表格页面上按下特定菜单时,学生可以在 10 分钟内通过 Android 应用向 Google 表格报告他们的出勤情况。
整个代码对 G Suite 用户来说运行良好,但我想实现 适用于所有 Gmail 用户。我试图从普通的 Gmail 中执行它,但它 最后显示超时。
我有以下两行代码让学生有 10 分钟的时间回复:
function refreshSheet(){
//Few other lines of codes are here
var val = dashboard.getRange("C6").getValue(); //C6 is a dropdown list in Sheets of "Start 1-Period" and "Start 2-Period"
if (val == "Start 1-Period"){ ScriptApp.newTrigger("onePeriod").timeBased().after(10*60*1000).create();}
if (val == "Start 2-Period"){ ScriptApp.newTrigger("twoPeriod").timeBased().after(10*60*1000).create();}
//These few lines of codes below within the refreshSheet() should be executed after the above called trigger and its function execution.
for (var i=0; i<students.length; i++) {
if (students[i][0] !== '') ss.removeEditor(students[i][0].toString());
}
protectionm.remove();
SpreadsheetApp.flush();
}
function onePeriod(){}
function twoPeriod(){}
我在这里查看了一些帖子,但没有一个对我有用。我该如何解决?
【问题讨论】:
-
欢迎来到 StackOverFlow,请借此机会参加 tour 并学习如何使用 How to Ask、format code、minimal reproducible example 和 Tag Info
标签: google-apps-script google-sheets web-applications