0
다음 코드를 사용하여 시트에서 이메일을 보내고 있지만 문제가 있습니다 ...시트 응용 프로그램 스크립트 - 이메일로 보낼 행을 반복하십시오.
전송 된 다음 반복으로 이동할 수 없습니다 column = "예"ie : 전송 된 열 = ""인 행만 포함하고 싶습니다.
미리 도움을 청하십시오.
function sendEmail() {
//setup function
var ActiveSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var StartRow = 2;
var RowRange = ActiveSheet.getLastRow() - StartRow + 1;
var WholeRange = ActiveSheet.getRange(StartRow,1,RowRange,11);
var AllValues = WholeRange.getValues();
var message = "";
//iterate loop
for (i in AllValues) {
//set current row
var CurrentRow = AllValues[i];
//define column to check if sent
const EmailSent = CurrentRow[11];
//if row has been sent, then continue to next iteration
if (EmailSent == "Yes")
continue;
//set HTML template for information
message +=
"<p><b>Date of Works: </b>" + CurrentRow[0] + "</p>" +
"<p><b>Customer: </b>" + CurrentRow[1] + "</p>" +
"<p><b>Project No: </b>" + CurrentRow[2] + "</p>" +
"<p><b>Project: </b>" + CurrentRow[3] + "</p>" +
"<p><b>Location: </b>" + CurrentRow[4] + "</p>" +
"<p><b>Site Contact: </b>" + CurrentRow[5] + "</p>" +
"<p><b>Starting Point: </b>" + CurrentRow[6] + "</p>" +
"<p><b>Start Time: </b>" + CurrentRow[7] + "</p>" +
"<p><b>Truck Size: </b>" + CurrentRow[8] + "</p><br><br>";
//set the row to look at
var setRow = parseInt(i) + StartRow;
//mark row once Sent
ActiveSheet.getRange(setRow, 11).setValue("Yes");
}
//define who to send email to
var SendTo = "[email protected]"
//set subject line
var Subject = "#6 Test - 2 - Selected Rows";
//send the actual email
MailApp.sendEmail({
to: SendTo,
cc: "",
subject: Subject,
htmlBody: message,
});
}
때 emailsent을 어떤 일이 일어날해야 == 네? –
CurrentRow 11 = yes이면 현재 행을 건너 뛰고 다음으로 이동하십시오. – Nish1585
나는 테이블을 필터링하고 전자 메일 본문에 서식이 지정된 테이블로 보낸 가시 범위 만 갖고 싶습니다. 내가 그 일을 할 수 없을 때, 이것은 차선책으로 보였다. – Nish1585