Google App Script Error: You do not have permission to call getActiveForm?

蹲街弑〆低调 提交于 2019-12-06 04:14:07
David Wantuch

I'm running into the same issue. My script just took the form response and formats into an email. Similar to the OP I do not make a single call to FormApp.getActiveForm() anywhere in my script.

This permissions issue started immediately after I added a PropertiesService.getScriptProperties() call.

While not a full fledged solution, I was able to work around this by adding a line for just FormApp.getActiveForm(), saving, then saving my triggers (to check for permissions again). I was asked to confirm Offline Access permissions for the script.

I then removed the unneeded line and the form worked fine.

Deleting the trigger from the UI and re-adding it prompted it to request a new permission, "offline access." I granted this, and it worked from then on.

It is very strange but your script must have a permission to Google Drive. Insert some code in the script so app will ask a permission for it (for e.g.):

var d = DriveApp.getRootFolder();

then run the script, give the permission. After that you can delete inserted line unless you copy the code from one form to another.

I had the same issue on a script that was attached to a spreadsheet but did something when the form that supplied that spreadsheet with data was submitted. I found under Resources->All Triggers that I had a residual Notification with an Event listed as "From Form". Since the script acts in the spreadsheet having a "From Form" event notification was causing the error.

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