onOpen trigger not being activated on Google Form

女生的网名这么多〃 提交于 2019-12-06 07:57:45

The trigger you need to install is not an onOpen but an onFormSubmit. is shows up in the script editor/ressources/current script trigger

see illustration below

As you have read (but aparently not understood), the onOpen trigger fires only when someone opens the form editor, not when someone fills in (submits) the form.

About the second point, there is no way to whitelist users that would be allowed to fill a form, all you can do is to select the answers based on used names and eventually reject answers that you don't allow.

If this access control is really vital for you you could achieve something quite efficient using UiApp or HTML service but that would be a bit more complex.

Concerning your last point about permissions, things are very simple : installable triggers run as the user who created the trigger. If you did then the script will run as if you ran it manually, using your priviledges and access rights.

I think that the trick to this is to setup the your script to trigger on the edit of the spreadsheet where the data that populates the form exists. You would probably need to check in the onEdit(e) event to see if you actually need to act such as checking the event object for what was edited. This way, as soon as you update the source data, the form us updated for you (vs when the form is opened).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!