Hello friends!! In previous post you have learnt that how to convert google sheet data into JSON so that you can select desired data directly from the google sheet and you can use it where ever you want. Now in this post I will insert the data into google sheet using html. This is a very simple tutorial. Please comment if you face any problem regarding this topic..so lets start..

Step : 1-  Create a blank spreadsheet using : http://sheets.google.com
Step : 2 – Click on Tools and then select “Script Editor”.
Step : 3 – Copy and paste the following code there and save

function doPost(e){
  var vals=[];
  vals.push(new Date());
  for(var i in e.parameter){
    vals.push(e.parameter[i]);
  }
 var target = SpreadsheetApp.openById("YOUR-SHEET-ID-HERE")
 var target_sheet = target.getSheetByName("Sheet1");
 target_sheet.appendRow(vals);
  return ContentService.createTextOutput("added");
}
Step :4- Publish this as a Web App and copy the web app url. This url will be used in html form to submit data.
Step 4 – Create a html form
<form  id="form" method="post" action="YOUR-WEB-APP-URL-HERE">
<input type="text" name="name" placeholder="Name"><br>
<input type="text" name="email" placeholder="Email">
<input type="submit" value="Subscribe"/>
</form>
Save this form as index.html in your server or anywhere else and thats it done…Don’t forget to edit sheet id and web app url..