简体   繁体   中英

How to send data to google spreadsheet from html form

I have Lname Fname input and I want to send its value to google spreadsheet. how do I do that? Can u please provide some simple ways or tutorials for newbie. Guide on google api developer too confusing

 <!DOCTYPE html> <html> <head> <title>Test Google Forms</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> </head> <body> <div> <div> <strong>Test Google Form</strong> </div> <form id="form" target="_self" onsubmit="" action=""> <fieldset> <label>Question 1</label> <input id="qs1_op_1" type="radio" value="Yes" name="qs1"> <input id="qs1_op_2" type="radio" value="No" name="qs1"> </fieldset> <fieldset> <label>Question 2</label> <input id="qs2_op_1" type="radio" value="Yes" name="qs2"> <input id="qs2_op_2" type="radio" value="No" name="qs2"> </fieldset> <fieldset> <label>Text</label> <textarea id="feed" name="feed"></textarea> </fieldset> <div style="width: 100%; display: block; float: right;"> <button id="send" type="submit"> Send </button> </div> </form> </div> <script type="text/javascript"> function postToGoogle() { var field1 = $("input[type='radio'][name='qs1']:checked").val(); var field2 = $("input[type='radio'][name='qs2']:checked").val(); var field3 = $('#feed').val(); $.ajax({ url: "https://docs.google.com/forms/d/FORM_KEY/formResponse", data: {"entry.1023121230": field3, "entry.1230072460": field1, "entry.2113237615": field2}, type: "POST", dataType: "xml", statusCode: { 0: function() { //Success message }, 200: function() { //Success Message } } }); } $(document).ready(function(){ $('#form').submit(function() { postToGoogle(); return false; }); }); </script> </body> </html>

For more detils check these links https://wiki.base22.com/pages/viewpage.action?pageId=72942000

http://quandaflow.com/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM