I have simple script to send e-mail based on data in spreadsheet.
Column 1 is Subject. Column 2,3,4,5 is body.
The problem is - the dipper I am in spreadsheet - the more commas script send in the end of e-mail message. If this is 1st row - no additional commas. 2nd row - 2 commas, 3rd row - 4 commas and so on.
How to get rid of these not required commas? I am really sorry for this newbie question.
The code is
function sendEmails() {
var time = new Date;
Logger.log(time);
var sheet = SpreadsheetApp.getActiveSheet();
var hojaRegistro = SpreadsheetApp.getActive();
var activeRow = hojaRegistro.getActiveCell().getRow();
var subject = sheet.getRange(activeRow, 1, activeRow, 1).getValues();
var message = sheet.getRange(activeRow, 2, activeRow, 5).getValues();
MailApp.sendEmail('[email protected]', subject, message);
sheet.getRange(activeRow, 6).setValue('E-mail sent on ' +time);
SpreadsheetApp.flush();
}
function onOpen() {
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var entries = [{
name : "Send Email",
functionName : "sendEmails"
}];
sheet.addMenu("Script Center Menu", entries);
};