rt_
rt_

Reputation: 1195

How to connect an html form submission on an external web app to a user's google sheet?

There are plenty of examples on how to use an apps script web app to connect HTML forms to google sheets. However all these refer to a scenario where the owner of the spreadsheet/form is the developer, such as this method. The owner/creator of the spreadsheet/form is not dynamic in these cases as far as I can see.

In my use case I want users to create their own HTML Forms based off data from a spreadsheet in their drive and receive responses in that sheet. So we are talking about multiple users creating their own spreadsheet in their own google account/drive instance and connecting that to my external web app to display the form to the users who have the link.

The flow is like this:

  1. User1 creates Google SpreadSheet in their drive
  2. User1 uses our add on to create the form/link
  3. User1 sends the links out
  4. Receiving Users go to the link which leads to my external web app to fill out the form and submit a response
  5. User1 receives responses in another sheet in the same spreadsheet in their drive.

This is repeated for x amount of users.

I'm thinking this will be done through a sheet add on, but I'm not sure how to connect the add on to the external web app. In the link above it is done by creating an apps script web app, but I can't ask the user to do that/programmatically do it for them.

What options do I have? There needs to be a url to send data to, with a process listening for said data that I can then run a function on.

Hopefully there is some api for this, maybe for drive?

P.S In case anyone is suggesting that I use google forms for this, google forms is great but it is limited in UI options and to a question and answer format. I'm looking to include search/filter functionality for possibly hundreds of list items with a quantity field. So it can't be done in forms.

Upvotes: 0

Views: 763

Answers (1)

Chase
Chase

Reputation: 3105

This should be possible given the following constraints: 1. The form "owner" would need to pass the Sheet IDs of the source and destination to you and, 2. both of those Sheets would need to be publicly readable and writeable.
AppScript is great for manipulating Docs and Sheets you own, but in your case you'll want to use the core Sheets API instead.
Your application which handles responses is probably best implemented using one of the SDKs depending on which language you write it in.

Upvotes: 1

Related Questions