Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

226
Views
string search in app script is not working

I am having one google sheet (sheet1) of supplier details. The column names are CODE, SUPP, PLACE with rows of around 300 plus. When I want to search the supplier name having "IMPEX", I am using following google sheet query formula:

=QUERY(Sheet1!A1:C200, "SELECT A, B, C WHERE B CONTAINS '%IMPEX%' ",1)

the Google sheet query is fetching the details. And the results comes as following, which is fine.

CODE    SUPP                         PLACE
1138    IMPEX STEELS PVT LTD         BANGALORE
1278    SHIVAM IMPEX LTD             BANGALORE
1345    IMPEX INC,                   CHENNAI
1456    RADHE STEEL IMPEX            MUMBAI

Now I want to use this in Google Apps Script. I wrote the following code but it is not working. Could someone edit or rectify it?

function searchName{

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var ws = ss.getSheetByName("Sheet1");/
  var dr = ws.getRange("A1:C360"); 
  var data = dr.getValues(); 

  //show the search results in the same sheet on D15 cells
  Var D15 = ws.getRange("D15:F20")

  var result = [];

   for (var i =0; i< data.length; i++){
         if(data[i][1] = "IMPEX"){        
          result.push(data[i]);

         // Logger.log(result)
         d15.displayRow(result);
          
          }
    }
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!