我试图创建一个脚本来检查单元格是否是某种颜色,例如#00ff00。如果单元格颜色不是000000,我希望脚本能够获取该单元格中的电子邮件地址并发送电子邮件。每次我在参数列表后运行以下脚本" Missing)。 (第22行,文件"代码")"
有人能帮助我吗?感谢。
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 < 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();
}}}}
答案 0 :(得分:0)
还有一个额外的;在{下面一行:
之前if(cell!= results.getRange()。getBackgroundColor(00ff00)); {