Google Script Error: You do not have permission to call openById

前端 未结 2 715
感动是毒
感动是毒 2021-01-14 15:11

I am trying to send a mail with attaching a file available in my google drive using following google scripts

var file=DriveApp.getFileById(\'1qZVK0UZ1jLbDdj1         


        
2条回答
  •  佛祖请我去吃肉
    2021-01-14 15:39

    I found this when creating the script on the Form itself.

    To solve the problem first have you form responses sent to a spreadsheet.

    From you form go to Tools > Script editor... copy you script and delete any triggers you have set up there, you won't be needing this script anymore.

    Now click on View responses button in your form to open the spreadsheet.

    • Go to Tools > Script editor... (for the spreadsheet).
    • You should start with a blank project.
    • Delete anything in there and paste in your script.
    • Save and name you project.

    Now set up your triggers as normal. You will find the third drop down list of the new trigger has the option On form submit.

    Once your script is authorised any time the form is submitted the event will trigger and will have access to the DriveApp.

    Once you've tested and got it working I would go back to the form and delete the script project in there. I do that to keep things tidy and save confusion if I come to alter the script later and have forgotten which one is actually live.

    I don't know if there is a limitation with Google Forms that limits their access to Drive or something.

提交回复
热议问题