title: Why can't I get the search result using an app I made using Google App Script, even if I surely have the data?
body: <p>By following the instruction of <a href="https://www.bpwebs.com/create-web-forms-to-get-data-from-google-sheets/" rel="nofollow noreferrer">this website</a>, I made a web app using Google App Script (GAS) which will display the search when a user enters a search term (e.g. order number, status, price) in the search window and the search is successful (The screenshot below represents what I expected). However, my app always returns 'Data not found!' even if the search term exists in the data. What am I missing, then?</p>
  <p><a href="https://i.stack.imgur.com/AW0r0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AW0r0.jpg" alt="enter image description here" /></a></p>
  <h1>Components of the app</h1>
  <h2>Data</h2>
  <p>A spreadsheet that contains the exactly same contents of <a href="https://docs.google.com/spreadsheets/d/142FbylWc7109R0RsXQ42NuN_TFs-D3RTtIYJOSBR1QM/edit#gid=0" rel="nofollow noreferrer">the original spreadsheet</a>
  (i.e. I copied the original contents and pasted them to my own spreadsheet to prepare the data)</p>
  <h2>Index.html</h2>
  <p>I copied the code from
  <a href="https://gist.github.com/bpwebs/dbbd96f8262e486c8f4c321ea0d3a95a#file-index-html" rel="nofollow noreferrer">https://gist.github.com/bpwebs/dbbd96f8262e486c8f4c321ea0d3a95a#file-index-html</a>
  and pasted it to 'Index.html' in my own GAS project.</p>
  <h2>Code.gs</h2>
  <p>I modified the original code on
  <a href="https://gist.github.com/bpwebs/dbbd96f8262e486c8f4c321ea0d3a95a#file-code-gs" rel="nofollow noreferrer">https://gist.github.com/bpwebs/dbbd96f8262e486c8f4c321ea0d3a95a#file-code-gs</a>
  since the original code has an undefined variable (<code>Sheets</code> on <a href="https://gist.github.com/bpwebs/dbbd96f8262e486c8f4c321ea0d3a95a#file-code-gs-L19" rel="nofollow noreferrer">ln.19</a>) and cannot open the spreadsheet. I replaced the relevant code with <code>SpreadsheetApp.openById()</code> and <code>range.getValues()</code>.</p>
  <pre class="lang-js prettyprint-override"><code>function doGet() {
    return HtmlService.createTemplateFromFile('Index').evaluate();
  }
   
   
  /* PROCESS FORM */
  function processForm(formObject){  
    var result = &quot;&quot;;
    if(formObject.searchtext){//Execute if form passes search text
        result = search(formObject.searchtext);
    }
    return result;
  }
   
  //SEARCH FOR MATCHED CONTENTS 
  function search(searchtext){
    // var spreadsheetId   = '1p7fKVM7HA4Ikl8gYC2WesmHcIqAqJQWTfIuiqB4SyN4'; //** CHANGE !!!
    // var dataRage        = 'Data!A2:Y';                                    //** CHANGE !!!
    var ss = SpreadsheetApp.openById('The URL to my spreadsheet');
    var range = ss.getRange('Data!A2:Y');
    var data = range.getValues();
    // var data = Sheets.Spreadsheets.Values.get(spreadsheetId, dataRage).values;
    var ar = [];
     
    data.forEach(function(f) {
      if (~f.indexOf(searchtext)) {
        ar.push(f);
      }
    });
    return ar;
  }
  </code></pre>