In this article, i am going to work on insert the data from html to google spread sheet using java script and apps script. apps script is used to manage the G Suite to automate the documentation and etc.
In this project, we can find the 2 main steps. each step has its own coding. step one has the pure Apps Script and the second step has html with java script.
Step 1. Here, I am going to create apps script for insert operation. Before creating apps script we have to create the spread sheet and take spread sheet id.
- Login Gmail account
- Go to Google Drive
- Create new Spread Sheet and save as "Give any name here"
- Click on Tools
- Click on Script Editor
Note: At point number 3, Please take the spreadsheet id as shown below image and keep it in note pad for future reference. take the id after back slash as shown below image.
In spread sheet please give some column names as shown below image
click on Tools --> go to Script editor and write the required code for insert operation.
- e.parameter.action is used to getting the query
- SpreadsheetApp.openById(" paste here, your spread sheet id") is used to give spread sheet id which one saved in note pad
- getSheetByName("sheet name") is used to get the sheet name
- return the insert_data(e.sheet) is used to return the sheet
insert_data is the one more function to do the insert operation in spread sheet which are coming from UI. below image has the code on insert operation.
Till now step one is completed. now we have to complete the step two. in step 2 we can find the html and ajax calls in javascript.
Step 2. create the html and ajax calls in java script.
below images show the html code and java script.
Below code shows the Java script Code for HTML.
The Final Out put looks like below image
Request for code from Contact Form
Post a Comment (0)