Currently this code is only applied to the sheet called "Name" I wanted applied to all except for 3 sheets (Template,Summary and Count):

 function EqualValue() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("Name");
  var value = sheet.getRange("A5").getValue();
  if(value >= "15") sendEmail(value)


function sendEmail(value){
  var recipient="Tester@test.com";
  var subject=" test subject " +value;
  var body="The Value is "+value;
  MailApp.sendEmail(recipient, subject, body);

I am not sure how is best to do this.

  • @Rubén Unfortunately I tried that and it did not work
    – RealHelper
    Dec 17, 2018 at 12:52
  • Please update the question to show what you tried and a brief description of what you know about Javascript conditions. Dec 17, 2018 at 15:02

1 Answer 1

    function EqualValue() {
  var allSheetTabs,i,L,thisSheet,thisSheetName,sheetsToExclude,value;

  sheetsToExclude = ['Template','Summary','Count'];

  var ss = SpreadsheetApp.getActiveSpreadsheet();

  allSheetTabs = ss.getSheets();

  L = allSheetTabs.length;

  for (i=0;i<L;i++) {
    thisSheet = allSheetTabs[i];
    thisSheetName = thisSheet.getName();

    //continue to loop if this sheet is one to exclude
    if (sheetsToExclude.indexOf(thisSheetName) !== -1) {continue;}

    value = thisSheet.getRange("A5").getValue();
    if(value >= "15") sendEmail(value)

And soo on

Not the answer you're looking for? Browse other questions tagged or ask your own question.