为'表单提交'触发器指定表单 [英] Specifying form for 'on form submit' trigger
问题描述
我有两个Google表单,它们将数据发送到一个电子表格中的两个选项卡。
我已经设置了一个具有两个功能的脚本。我希望第一个函数能够在提交第一个表单时运行。而第二个函数在提交第二个表单时运行。
问题是:在设置触发器时,它不允许指定哪个 b 因此,无论何时完成第一个表单,它都会运行这两个函数。 问题:如何限制函数仅在提交特定表单时运行?
$ b
只是看了一些文档,发现这一点:
它表示:
< blockquote>
创建并返回绑定到给定表单的FormTriggerBuilder。
另外:
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
ScriptApp.newTrigger('myFunction')
.forForm(form)
.onFormSubmit()
.create();
该代码似乎与特定的表单绑定。 / p>
I have two google forms, which send data to two tabs in a single spreadsheet.
I have set up a script with two functions. I would like the first function to run on submission of the first form. And, the second function to run on submission of the second form.
Problem is: when setting up a trigger onformsubmit, it does not allow you to specify which form.
Therefore, whenever completing the first form, it runs both functions.
Question: how can I restrict the functions from running only when the specific form is submitted?
I was just looking at some documentation and found this:
It states:
Creates and returns a FormTriggerBuilder tied to the given form.
Also:
var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
ScriptApp.newTrigger('myFunction')
.forForm(form)
.onFormSubmit()
.create();
That code seems to be tied to a specific form.
这篇关于为'表单提交'触发器指定表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!