I made a script that makes a copy of its related Google Form after making a few changes to it. Although I've already authorized the script to modify my Google Drive data, it only works properly when the tab where the scripts is written is opened. I used the
onOpen() trigger so the script is supposed to work whenever the page is opened or refreshed.
Here is the code and the error that I'm receiving when I have just the form tab opened:
Code: var pastas = DriveApp.getFolderById("xxxxxxxxxxxxxxxxxxxx").getFolders();
Error: Execution failed: You have no permission to call getFolderById (line 114, file "Código")
What can I do to fix this?