Skip to main content
Key2Goal

Main navigation

  • Home
  • About Us
  • Contact us
  • Glossary
  • Privacy Policy
User account menu
  • Log in

Breadcrumb

  1. Home

Using HTML submit form data to google speedsheet using appscript

Hello, today we will see how we can upload the data in a Google spreadsheet using Google App script. So let's start

We need to follow the 5 steps for doing that:

Step 1. Create a spreadsheet on Google Spreadsheet, log in to your account, and create a spreadsheet. Once that is done Copy the URL of the spreadsheet from the address bar that we can use in Step 2.

Step 2. Now on the spreadsheet click on Extensions>> Appscript to open the google app script editor here you are able to the code.gs file so copy and paste the below code into that :

let getSheet = SpreadsheetApp.openByUrl("https://docs.google.com/spreadsheets/d/1VFidYhWsdfsdf77rYshIZqz-TfPMsdfX50wE9DCSsdfAWrT4uelftedgh8hoEQk/edit#gid=0")
let sheet = getSheet.getSheetByName("Sheet1");

function doPost(e){
  let data = e.parameters;
  sheet.appendRow([data.first_name[0], data.last_name[0], data.dob[0]]);
  return ContentService.createTextOutput("submitted")
}

Note: you need to Put your Spreadsheet URL

Step 3. Now Create the triggers using the left panel 

 

 

Create a new trigger with the following settings, Web app

And Hit Save.

 

Step 4. Now "Deploy", At the top right corner of the page, the Deployment button is there, click on it and choose "New Deployment".

Hit Deploy Button and it will show you the web URL link just like below Image & Copy that URL and we will use that in the next step:

Step 5. Now create an HTML form using the below code and open that page into the browser:

<form method="POST" action="https://script.google.com/macros/s/AKfycbxSjowvhErgstshndfsh79tgV9PW0g8fZFue44zN-5w-wrqc9z7jWdFJCBZW3bd_y5-wKq/exec">
    <input type="text" name="first_name" placeholder="First Name"/>
    <input type="text" name="last_name" placeholder="Last Name"/>
    <input type="text" name="dob" placeholder="DOB"/>
    <input type="submit" value="Submit" />
</form>

Note: use the web app URL that you copied in the last step in action="<your_url>"

Once you HIT the Submit button it will update the data in Spreadsheet that we mention in Step1.

 

Thanks, If you the post do share it with others, 

Happy learning

  • Log in to post comments

Comments

Article category

  • Drupal
  • Wordpress
  • Java
  • Javascipt
  • HTML
  • CSS
  • IOS
  • Android
  • PHP
  • MySQL
  • Other
  • Command line
  • NodeJs
  • Drupal 8
  • Drupal 7
  • GIT
  • DevOps
  • Python
  • Xampp
  • Server
  • Artificial intelligence
  • AppScript

Recent content

  • Differences Between Bootstrap 3 & Bootstrap 4
    10 hours 55 minutes ago
  • About Us
    15 hours 49 minutes ago
  • Privacy Policy
    17 hours 43 minutes ago
  • Create a Virtual Host on Xampp in 5 steps
    1 month 1 week ago
  • How to setup Multisite in drupal 9
    7 months 3 weeks ago
  • How to creating a FOR loop and a WHILE loop in JavaScript
    7 months 3 weeks ago
  • Calculator program HTML & PHP
    7 months 3 weeks ago
  • Algothrim to create a web application
    7 months 3 weeks ago
  • 10 Git Useful Commands for Every Developer
    7 months 3 weeks ago
  • Top 10 useful commands for GIT with example
    7 months 3 weeks ago
© Copyright 2017 - 2026 key2Goal. All Rights Reserved