2

I have created a script for collaborators, to be used in google sheets. When they trigger the script, it submits a form response, that then gets used to modify a "central" spread sheet.

But I am faced with a permission problem, and I haven't managed to find a convenient answer to it on the net.

The script uses FormApp.openById([...]).createResponse().[....].submit().

The problem comes from the fact both openById() and openByUrl() need the person who runs the script to be able to edit the form.

(As said on the Class FormApp help page : Returns the Form with the specified URL. Throws an exception if the URL is invalid or the user does not have permission to open the form.)

I have so far found 2 workarounds :

  • Give edit access for the form to my collaborators : it then shares them a form they shouldn't edit.

  • Change the link-sharing of the form to "on" : although no one but me actually knows the form Id, I don't really like the possibility of anyone discovering the link to be able to edit the form.

Neither of these workarounds completely satisfies me, and I'm sure there must be a way to submit a response via a script without being able to edit the form - just as people who send answers to google forms can't generally edit the questions ! Just I can't figure out how.

Any help on this problem will be very much appreciated !

Thank you,

Mike

1 Answer 1

1

Create a Web App using an account with owner or editor access to the form and set it to be run as the script owner. For a general guide see https://developers.google.com/apps-script/guides/web

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.