title: Google Apps Script: Trying To Send Emails Based Upon Background Color Of Cell
body: <p>I'm trying to create a script that checks if a cell is a certain color for instance #00ff00. If the cell color isn't 00ff00, I would like the script to take the email address in that cell and send an email. Everytime I run the following script "Missing ) after argument list. (line 22, file "Code")"</p>
  
  <p>Can someone help me? Thanks.</p>
  
  <pre><code>var EMAIL_SENT = new Date() ;
  
  function sendEmails2() {
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); 
  var sheet = spreadsheet.getActiveSheet();
  
  var startRow = 2;  // First row of data to process
  var numRows = 2;   // Number of rows to process
  // Fetch the range of cells A2:B3
  var dataRange = sheet.getRange(startRow, 1, numRows, 3)
  // Fetch values for each row in the Range.
  var data = dataRange.getValues();
  
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  
  // Trying to get the color of a cell, if the color matches 00ff00, then I       want the for loop to skip that cell and move to the next one.
  var cell = sheet.getRange("A1").getBackgroundColor();
  
  If(cell != results.getRange().getBackgroundColor(00ff00)); {
  
  
  for 
  (var i = 0; i &lt; data.length; ++i) {
  var row = data[i];
  var emailAddress = row[0];  // First column
  var message = row[1];       // Second column
  var currentp =  spreadsheet.getUrl();  //current spreadhseet page
  var emailSent = row[2];     // Third column
  if (emailSent != EMAIL_SENT) {  // Prevents sending duplicates
    var subject = "Sending emails from a Spreadsheet";
    MailApp.sendEmail(emailAddress, subject, message,currentp);
    sheet.getRange(startRow + i, 3).setValue(EMAIL_SENT);
    // Make sure the cell is updated right away in case the script is interrupted
    SpreadsheetApp.flush();
   }}}}
  </code></pre>