title: Custom form (Web App) to send value and use it with Google Apps Script
body: <p>I'm trying to create a custom form in order to send one value (ID) and below of the form see the search result based on the input field.</p>
  <p>For example: Complete the form and below see the search result in a DataBase (Google Sheets)</p>
  <p><a href="https://i.stack.imgur.com/Fk2gn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fk2gn.png" alt="DataBase - Google Sheets" /></a></p>
  <p><a href="https://i.stack.imgur.com/yCkDH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yCkDH.png" alt="Request Form" /></a></p>
  <p>I saw some examples but I don't know how to get the value of the input field and use it with the Google Apps Script code (in order to search the ID in the rows).</p>
  <p>Here some code I was trying:
  code.gs</p>
  <pre><code>function doGet() {
    return HtmlService.createHtmlOutputFromFile('index')
        .setSandboxMode(HtmlService.SandboxMode.IFRAME);
  }
  
  
  function obtenerId() {
    var email = Session.getActiveUser().getEmail();
    var idtest='Juan';
    return messageSecret_(idtest);
  }
  
  function messageSecret_(urldoc) {
    return 'test'+urldoc;
  }
  </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=&quot;_top&quot;&gt;
      &lt;script&gt;
        function onSuccess(balance) {
          var div = document.getElementById('output');
          var idtest = document.getElementById('ingresoid').value;
          div.innerHTML = balance+' '+idtest;
        }
  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      
      &lt;!--Modificar texto de la aplicación --&gt;
      &lt;p style=&quot;margin-bottom: 16px; font-family: 'Verdana regular'; font-size: 16px;color: #727277;line-height: 16px;text-align: justify;&quot;&gt;Ingrese ID:
      &lt;br&gt;&lt;br&gt;&lt;/p&gt;
      &lt;input type=&quot;textbox&quot; id=&quot;ingresoid&quot; size=&quot;20&quot;&gt;
      &lt;br&gt;&lt;br&gt;
      &lt;input type=&quot;button&quot; value=&quot;Enviar respuesta&quot; onclick=&quot;google.script.run.withSuccessHandler(onSuccess)
            .obtenerId();&quot; style=&quot;background-color:#C1D72E;border-radius:10px;padding:5px;color: #fff; border-color: #C1D72E;&quot;
        /&gt;&lt;br&gt;
        &lt;br&gt;
        
        &lt;div id=&quot;output&quot;&gt;&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>