任何人都可以帮我修改此脚本,以便它将向当前第6行中具有“发送电子邮件”的任何人发送电子邮件,此问题已经发送给所有人,并且已经有一个星期的时间了, 预先感谢非程序员
function sendEmails2() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 4; // Number of rows to process
var dataRange = sheet.getRange(startRow, 1, numRows, 5);
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (var i = 0; i < data.length; ++i) {
var row = data[i];
var EMAIL_SENT = 'EMAIL_SENT';
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var emailSent = row[2]; // Third column
var emailSent = row[6]; // Seventh column
if (emailSent != EMAIL_SENT) { // Prevents sending duplicates
var subject = 'Sending emails from a Spreadsheet';
MailApp.sendEmail(emailAddress, subject, message);
sheet.getRange(startRow + i, 3).setValue(EMAIL_SENT);
SpreadsheetApp.flush();
}
}
}
https://docs.google.com/spreadsheets/d/1nV0VGwbyNiGcQAqmgTVSpdUB_NIISsrFkou0nyw8QQo/edit?usp=sharing