2016-06-10 66 views
0

我有Lname Fname輸入,我想將其值發送到谷歌電子表格。我怎麼做?你能否爲新手提供一些簡單的方法或教程。指導谷歌API開發太混亂如何從HTML表格發送數據到谷歌電子表格

+0

https://developers.google.com/sheets/ –

+1

HTTP ://stackoverflow.com/questions/19887737/pushing-data-to-google-spreadsheet-through-javascript-running-in-browser – Thinker

回答

0

<!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>

更多detils檢查這些鏈接 https://wiki.base22.com/pages/viewpage.action?pageId=72942000

http://quandaflow.com/