Store your form data to google sheets

Follow the following steps to store your form data to google sheets

  • Create a new blank google Sheet and organize it
  • Add Google Apps Script to your account
  • Add and Run the google script code
  • Add a new project
  • Publish your project as a web app
  • Create a html file and add your web app URL to the script src

Create a new blank google Sheet and organize it

First, go to Google Sheets and create a new blank spreadsheet.
Rename the sheet name
Organize your sheet column. Column name should be the same as it is here.

 

Add Google Apps Script to your account

On your sheet Click on the Tools > Script Editor. It’ll open in a new tab.
Rename the file name to Submit Form to Google Sheets and wait for save and update the title

On Code.gs tab delete the following code function myFunction() {}

Add and Run the google script code

On Code.gs file add the following code and save it

Then, go to Run > Run Function > initialSetup to run this code.
After running it’ll open an Authorization dialog box
Click on Review Permissions -> sign in within your gmail account and click allow. This means you are allowing google to run this script for your app. You’ve to allow this script.

Add a new project
On the top menu Click on the Edit > Current project’s triggers
There may be a dialog box No triggers set up. Now you’ve to create a trigger for your form/app.

Click on the No triggers set up button it’ll open a dialog box with few dropdown menu.

In the dropdown menu select doPost.Set the events fields to From spreadsheet and On form submit. Save it

Publish your project as a web app
On the top menu Click on Publish > Deploy as web app
Set your project version to New and put initial version in the input field below
set your email address ([email protected])
select Anyone, even anonymous from dropdown menu
click deploy
After that, It’ll open a dialog box with a script file
copy the script url
And then click ok

Create a html file and add your web app URL to the script src

Create a html file (index.html) and add the following code.

 

One thought on “Store your form data to google sheets”

Leave a Reply

Your email address will not be published. Required fields are marked *