title: .findIndex() - String is not a function. Google Apps Script
body: <p><strong>The Problem</strong></p>
  <p>.findIndex() is breaking. I'm providing it with a string, but it's saying &quot;It's not a function&quot;</p>
  <p><strong>Objective / Context</strong></p>
  <p>Auto reply to property inquiry</p>
  <p><strong>Function does the following:</strong></p>
  <ul>
  <li><p>Scans the inbox to identify inquiry.</p>
  </li>
  <li><p>Breaks down the email, storing the data in
  variables.</p>
  </li>
  <li><p>Scans a spreadsheet with information about all of our
  homes for sale. Matches the property ID in the email against the
  spreadsheet looking for the match.</p>
  </li>
  <li><p>Replys to the email with data stored in the spreadsheet that matches that property.</p>
  </li>
  </ul>
  <p><strong>Where I am up to</strong></p>
  <p>I am able to identify the email.
  I'm then able to scan through the email and pull the relevant information.</p>
  <p><strong>The Code</strong></p>
  <pre><code>function autoReply() {
  var queryInbox = &quot;is:unread from:(example@gmail.com) to:(example@gmail.com) Example Text:&quot;; // Email Identification
  var locatedEmail = GmailApp.search(queryInbox); // Search Inbox for Identification
  locatedEmail.forEach(thread =&gt; {
    var messages = thread.getMessages();
    if (messages.length === 1) {
      // BREAKING DOWN THE EMAIL
      var msgBody = messages[0].getPlainBody();
      var identityNumber = msgBody.split(&quot;\n&quot;)[1].replace('Property ID: ','');
    
      // SPREADSHEET      
      var SS = SpreadsheetApp.openById('exampleId').getSheetByName(&quot;Sheet1&quot;);
      var column = 1; // column Index
      var columnValues = SS.getRange(2, column, SS.getLastRow()).getValues(); //1st is header row
      var searchResult = columnValues.findIndex(identityNumber); //Row Index - 2
      var rowID = searchResult + 2;
    
      var houseAddress = SS.getRange(rowID, 2).getValue();
    
      // EMAIL BODY
      var body = &quot;&lt;p&gt;Hi, thank you for emailing us about &quot; + houseAddress + &quot;.&lt;/p&gt;&quot;;
      var options = { name: &quot;Property Enquiry&quot;, htmlBody: body };
      thread.reply(body, options);
      thread.markRead();
      thread.moveToArchive();
    }
  });
  }
  </code></pre>
  <p><strong>Example Email</strong></p>
  <p><a href="https://i.stack.imgur.com/tvhLR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tvhLR.png" alt="enter image description here" /></a></p>
  <p><strong>Example Spreadsheet</strong>
  <a href="https://i.stack.imgur.com/lNDSs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lNDSs.png" alt="enter image description here" /></a></p>
  <p><strong>Additional Information: Error is showing that it is passing a propertyID as a string to the .findIndex</strong></p>
  <p><a href="https://i.stack.imgur.com/R8tPi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R8tPi.png" alt="enter image description here" /></a></p>