如何为非G套件用户解决AppScripts的执行时间问题? [英] How to solve execution time issue of AppScripts for non-G suite users?

查看:56
本文介绍了如何为非G套件用户解决AppScripts的执行时间问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个考勤系统,对于G套件用户(执行时间为30分钟)可以正常使用,但我想使其对所有gmail用户都可以运行(执行时间为6分钟).老师按下我的Google表格页面上的特定菜单后,学生可以在10分钟内将自己的出勤情况从Android应用报告给Google表格.

I have an attendance system which is working fine for G suite users (execution time is 30 minutes) but I want to make it running for all gmail users (execution time 6 minutes). When a teacher presses a specific menu at my Google Sheets page, it allows students to report their attendance from an Android App to Google Sheet for 10 minutes.

对于G Suite用户,整个代码都可以正常工作,但我想做到这一点适用于所有Gmail用户.我尝试从常规Gmail执行它,但是它最后显示超时.

The whole code is working fine for G Suite Users but I want to make it for all Gmail users. I tried to execute it from a regular Gmail but it shows Timed Out at the end.

我有以下两行代码,让学生有10分钟的响应时间:

I have the following two lines of code for students to have 10 minutes to respond:

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(){}

我在这里评论了几篇文章,但没有一篇对我有用.我该怎么解决?

I reviewed few posts here but none of them is working for me. How can I solve it?

推荐答案

您可以执行以下两项操作:

  1. 如果您将脚本作为 WebApp ,您可以将其执行为您"-那是来自GSuite域的用户,其执行限制为30分钟.

  1. If you deploy your script as a WebApp, you can execute it as "You" - that is the user from a GSuite domain who has an execution limit of 30 min.

以其他方式设计脚本.

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆