I'm having difficults trying to write a script to send an email based on the below table
The "agent ldap" is the recipient the "TL ldap" is the CC and the rest 4 columns are inside the message as a table
I'd like the message be like:
Hello, follow your feedback regarding your requests that we have registered:
The table with the columns C, D, E and F
You can already check it on
My main difficult is cause the number of rows may change (no more than five rows), also the status can change of this three ways. I'll copy past the values on this sheet, then send the email.
Is there a way to add a conditional statement for the column F depending the name, to add the color the backgroung? Because I wanna include this column on the table too.
My script is:
function VacationRequest() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var startRow = 2; // First row of data to process
var numRows = 2; // Number of rows to process
var dataRange = sheet.getRange(startRow, 1, numRows, 2);
// Fetch values for each row in the Range.
var data = dataRange.getValues();
var emailRecipients = data[0] + "@google.com";
var CCEmail = data[1] + "@google.com";
var emailSubject = "Vacation request";
var emailBody = "Hello, follow your feedback regarding your requests that we have registered: \
\
"The table with the columns C, D, E and F"
\
You can already check"
MailApp.sendEmail({
to: emailRecipients,
subject: emailSubject,
htmlBody: emailBody,
CC: CCEmail
});
}