title: How can I add multiple inputs from an HTML UI to a Google Spreadsheet?
body: <p>I've got a spreadsheet with a button that links to a function in my Google Apps Script, <code>openInputDialog</code>. My desired outcome is that pushing the button opens an HTML UI where a user can input text to five fields, and the text is taken from that input and appended to a new row at the bottom of the spreadsheet. I'm experiencing an issue where when clicking the <code>submit</code> button nothing happens; the dialog does not close, and more importantly, there is not a new row appended with the values that are input in it.</p>
  
  <p>The code is as follows:</p>
  
  <p>addItem.gs:</p>
  
  <pre class="lang-js prettyprint-override"><code>function openInputDialog() {
    var html = HtmlService.createHtmlOutputFromFile('Index')
    return HtmlService.createHtmlOutputFromFile('Index')
    .setSandboxMode(HtmlService.SandboxMode.IFRAME);
    SpreadsheetApp.getUi()
    .showModalDialog(html, 'Add Item');
  }
  
  function itemAdd() {
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getSheets()[0];
    sheet.appendRow(["  ", 'category', 'item', 'manupub', 'details', 'quantity']);
  }
  </code></pre>
  
  <p>Index.html:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;base target="_top"&gt;
    &lt;/head&gt;
    &lt;br&gt;
    &lt;form&gt;
      Category:&lt;br&gt;
      &lt;input type="text" name="category"&gt;
      &lt;br&gt;
      Item:&lt;br&gt;
      &lt;input type="text" name="item"&gt;
      &lt;br&gt;
      Manufacturer or Publisher:&lt;br&gt;
      &lt;input type="text" name="manupub"&gt;
      &lt;br&gt;
      Details:&lt;br&gt;
      &lt;input type="text" name="details"&gt;
      &lt;br&gt;
      Quantity:&lt;br&gt;
      &lt;input type="text" name="quantity"&gt;
      &lt;br&gt;&lt;br&gt;
      &lt;input type="submit" value="Add Item"&gt;   
      &lt;/form&gt;
      &lt;script&gt;
       google.script.run.addItem();
      &lt;/script&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm pretty sure that the answer to my issue lies with some simple problem or misuse of some part of this script, but my programming knowledge is currently not good enough to properly understand the Google Apps Script documentation that I've been reading.</p>