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

92
Views
Google Sheet AppScript IF statement

I have a sales report as like below

enter image description here

I want to take Sale1person1 data if the Sale is Food Items and Sale1person2 if the Sale is Gadget and provide that to HTML file line

emailTemp.htmlsalevalue=row[???];

How to create if statement in emailTemp to get the corresponding data?

function myFunction() {
    var sale=9;
    var person1=10;
    var person2=11;
    
    var emailTemp = HtmlService.createTemplateFromFile("Table");
    var ws= SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Form Responses 3");
    var data = ws.getRange(ws.getLastRow(),1,1,ws.getLastColumn()).getValues();
    
    data.forEach(function(row){
    
        emailTemp.htmlsale=row[sale];
    
    })
}
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!