2
我使用以下腳本從Google表單發送電子郵件提醒,但希望對其進行修改,以便在每行的單元格F中指定的日期發送電子郵件。根據日期發送提醒電子郵件
var EMAIL_SENT = "EMAIL_SENT";
function sendEmails2() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 999; // Number of rows to process
// Fetch the range of cells A2:B999
var dataRange = sheet.getRange(startRow, 1, numRows, 999)
// 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 emailAddress = row[0]; // First column
var subject = row[1]; // Second column
var message = row[2]; // Third column
var emailSent = row[3];
if (emailSent != EMAIL_SENT) { // Prevents sending duplicates
MailApp.sendEmail(emailAddress, subject, message);
sheet.getRange(startRow + i, 4).setValue(EMAIL_SENT);
// Make sure the cell is updated right away in case the script is interrupted
SpreadsheetApp.flush();
}
}
}
這就是我所擁有的,任何嘗試在這裏添加日期都會失敗。
我遇到了這個早期的問題:Google Apps Script - Send Email based on date in cell,但無法將其與我的腳本相結合。
此,像變魔術一樣,謝謝!很好的瞭解日期假設,幸好所有假設都是真實的:) – Shadician