title: Get form input text value to insert in a Google Spreadsheet
body: <p>I have some code that works but I need to bring in a form <strong>value</strong> instead of my hard coded text. I am using Google Apps Script's HTML Service and a Google Spreadsheet to try to accomplish the goal. I am hoping an expert would be kind enough to share a solution.</p>
  
  <p>My index.html</p>
  
  <pre><code>&lt;div id="inputDiv"&gt;
    &lt;form id="inputForm" onsubmit="fncWriteInputData()"&gt;
      &lt;label&gt;Name:  &lt;/label&gt; &lt;br /&gt;
       &lt;input type="text" tabindex="1" id="idFirstInput" class="inptFld" placeholder="Add a name" required&gt;&lt;br /&gt;
       &lt;label&gt;Number:&lt;/label&gt; &lt;br /&gt;
       &lt;input type="text" tabindex="2" id="idSecondInput" class="inptFld" placeholder="Employee number" required&gt;&lt;br /&gt;
      &lt;br /&gt;
      &lt;input type="submit" tabindex="3" id="btnSubmitInput" value="Click To Submit"&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;hr&gt;
  &lt;? var data = getData(); ?&gt;
  &lt;table&gt;
    &lt;? for (var i = 0; i &lt; data.length; i++) { ?&gt;
      &lt;tr&gt;
        &lt;? for (var j = 0; j &lt; data[i].length; j++) { ?&gt;
          &lt;td&gt;&lt;?= data[i][j] ?&gt;&lt;/td&gt;
        &lt;? } ?&gt;
      &lt;/tr&gt;
    &lt;? } ?&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;script&gt;
   fncWriteInputData=function(){
      var value = (inputForm.idFirstInput)
      console.log("fncWriteInputData ran");
      google.script.run
      .fncRunAppScript(); //Runs server side .gs function    
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>My code.gs looks like</p>
  
  <pre><code>var submissioSSKey = '1N6uShSxHwhFYrfTDhJyp8ohCHpvElVAOtuGdQv3kt8k';
  function doGet() {
    return HtmlService
        .createTemplateFromFile('index')
        .evaluate()
        .setSandboxMode(HtmlService.SandboxMode.IFRAME);
  }
  
  function getData() {
    return SpreadsheetApp
        .openById(submissioSSKey)
        .getActiveSheet()
        .getDataRange()
        .getValues(); 
  }
  
  function fncRunAppScript(inputForm){
   var ss = SpreadsheetApp.openById(submissioSSKey);
   var sheet = ss.getActiveSheet();
   var lastRow = ss.getLastRow();
   var cell = sheet.getRange(lastRow+1, 1, 1,2);
   var value= "Frank"; //this works but I need the value in the text box
  //  var value = value.idFirstInput;//nogo
  // var value= index.html.inputForm.idFirstInput.getValue();//nogo 
   var value2= "123"; 
  // cell.setValues([[value1a,value2a]]);//this one works 
   cell.setValues([[value,value2]]);//this one works 
    }
  </code></pre>
  
  <p>If I rem "//"   </p>
  
  <pre><code>var value= "Frank"; //this works but I need the value in the text box
  </code></pre>
  
  <p>And try something like</p>
  
  <pre><code> var value= index.html.inputForm.idFirstInput.getValue();
  </code></pre>
  
  <p>I do not get the form value</p>
  
  <p>I am hoping someone can show me the way to grab a value from an input form so that it can be inserted into the spreadsheet.</p>