Google 表单 onFormSubmit 未触发

Google Form onFormSubmit not triggering

我正在处理的 google 表格有问题。我设置触发器如下所示。

提交表单时,应弹出一个警告框,其中包含从 google sheet 获取的信息。(该表单链接到 sheet)

当我 运行 来自脚本编辑器的代码时,它会在表单中显示弹出窗口,但当我向表单提交回复时,触发器永远不会触发。

我试过:

    • 正在删除触发器
    • 正在创建新版本的脚本
    • 重新添加触发器
  1. 将触发器更改为 TimeDriven,但仍然没有触发器

  2. 使用相同的触发器将脚本更改为独立脚本

不确定是什么问题,因为我可以手动执行代码。

正如 Sandy Good 所说:

A dialog box can't be shown in "View" mode of a Google Form. When you are running the code from the script editor, the pop-up that you are seeing is probably in the "Edit" mode of the Google Form. "On Form Submit" doesn't run from Edit mode. If you are trying to get something to display to the user after they submit the Form, then your only option is the confirmation message: FormApp.getActiveForm().setConfirmationMessage(message)

使用 .setConfimrationMessage(message) 可以实现我想做的事情。 (提交表单回复时给出sheet个单元格的列表)