Im currently using this script to send emails from my sheets
My problem is that im not getting the emails with the same format as my table
Any way to send email with the exact format as I have on the sheet ?
Thanks !
This is the code
function Reminder() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getSheetByName("Sheet1");
var range = sheet.getRange(1,1,sheet.getLastRow(),sheet.getLastColumn()-1);
var valueToCheck = sheet.getRange("F1").getValue();
// Optional init, to ensure the spreadsheet config overrides the script's
var conv = SheetConverter.init(ss.getSpreadsheetTimeZone(),ss.getSpreadsheetLocale());
// Grab an array for formatted content
var array = conv.convertRange(range);
Logger.log(JSON.stringify(array));
// Get a html table version, with all formatting
var html = conv.convertRange2html(range);
Logger.log(html);
//Enter your condition below
if(valueToCheck != 'OK'){
MailApp.sendEmail("test@gmail.com", 'Reminder','' ,
{name: 'Sen',htmlBody:
"Message " + "</br></br>" +
html + "</br></br>" +
})
}
}
The Sheet converter is a library for the script that should work https://sites.google.com/site/scriptsexamples/custom-methods/sheetconverter