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