【问题标题】:Shutdown Google Forms at given dates of the month and Open the form again at given dates of the month在该月的给定日期关闭 Google 表单并在该月的给定日期再次打开表单
【发布时间】:2021-04-21 17:21:41
【问题描述】:

抱歉新手问题。我有一个谷歌表格,我在每个月的第一天打开,然后在每个月的 21 日关闭。所以基本上用户只能在每月的前 21 天使用表单。我想知道是否有办法通过脚本以编程方式执行此操作。我知道这可以通过表单的附加组件来完成,但是我不想使用附加组件,因为我不知道这些代码在做什么,我想确保数据是保持在表格内的安全。很抱歉没有任何代码可以演示,但一直在做一些研究,似乎无法找到任何远程关闭它的东西。不能通过 Appscript 做到这一点吗?提前感谢大家的帮助。

【问题讨论】:

标签: forms google-apps-script google-sheets google-forms


【解决方案1】:

我能够使用触发器和脚本来执行此操作,将我的表单命名为“Play”

这是脚本:

function limitDays() {
  var form = FormApp.getActiveForm();
  var lastDay = 21;
  var currDate = new Date();
  var dayOfMonth = currDate.getDate();
  if (dayOfMonth > lastDay) {
    form.setAcceptingResponses(false);
  } else {
    form.setAcceptingResponses(true);
  }
}

【讨论】:

  • 这是完美的工作。再次感谢您
猜你喜欢
  • 2021-02-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多