Web Analytics Made Easy -
StatCounter Code breaks- Javascript within Google Sheets - CodingForum

Announcement

Collapse
No announcement yet.

Code breaks- Javascript within Google Sheets

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Code breaks- Javascript within Google Sheets

    Hey all, I'm working within the code editor of Google Sheets and I'd like this code to run when the value of a cell is set to a specific value.

    Code:
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var s = SpreadsheetApp.getActiveSheet();
      var c = s.getActiveCell();
      var r = s.getActiveRange();
    
    
     if( c.getColumn() == 6 )
          {
            if( c.getValue() == 'Reworks Requested' )
            {
              var row = r.getRow();
              var numColumns = s.getLastColumn();
              var targetSheet = ss.getSheetByName("Peer Tally");
              var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
              s.getRange(row, 1, 1, numColumns).copyTo(target);
              
              // SEND EMAIL - CHECK REPORT
              var user = s.getRange(c.getRow(), 12).getValue();
              var mgmt = s.getRange(c.getRow(), 5).getValue();
              var code = s.getRange(c.getRow(), 3).getValue();
              sendCheck(user, mgmt, code);
            }
    If I delete out everything within my if function ABOVE the //SEND EMAIL code, it runs totally fine when the value is changed and sends an email to the user (sendCheck). However, with the code above the //SEND EMAIL included, it breaks the code and no longer sends the email when it's run. I'd like both portions to be executed. Can anyone help me troubleshoot why this is happening? Thanks so much!
Working...
X