I am creating a Google Apps script in which I want to use the FormApp
service to get the active form, however it keeps throwing an exception:
You do not have permission to call FormApp.getActiveForm. Required permissions:
(https://www.googleapis.com/auth/forms.currentonly ||
https://www.googleapis.com/auth/forms) (line 7, file "Code")
I have enabled permissions to both Google Drive API, and to Google Sheets API - but can't find an API labeled as "Forms" anywhere in the Google Cloud Platform API Dashboard.
Googling has not turned up anything useful, just more links to the API documentation.
Any idea which API FormApp is classified under?
I don't want to have to enable every single API to find out...
For future people who come across this post, I resolved my issue by manually adding the following to my Manifest file:
"oauthScopes": [
"https://www.googleapis.com/auth/forms",
"https://www.googleapis.com/auth/spreadsheets"
],
You can find your Manifest file by clicking on View > Show Manifest File
- this will make a file called appscript.json
appear in your sidebar.
Then click Run
or the play button in the toolbar - which will force the app to review permissions and prompt you to authorize with your account.
Note: A good point that @tehhowch has pointed out below is that adding this manually to your manifest will disable auto-detection of scopes. My auto-detection doesn't seem to be working correctly anyway, so I've gone ahead with this manual solution - just a word of warning.
Put
FormApp.getActiveForm();
in the first line of your function you're calling and manually call that function from editor. It asks you for permissions before it realises you're calling it from the editor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With