Hi am trying to send a table to a mail from a google spreadsheet but all am getting is "[object Object]" in mail, here is my script.
function sendEmail() {
var s = SpreadsheetApp.getActive().getSheetByName('Summary');
var ss = SpreadsheetApp.getActiveSpreadsheet();
var range = ss.getActiveSheet().getDataRange();
var range = s.getRange('A1:D8');
var to = "srinath@example.com";
var body = '';
var htmlTable = SheetConverter.convertRange2html(range);
var body = "Here is the table:<br/><br/>"
+ htmlTable
+ "<br/><br/>The end."
MailApp.sendEmail(to, 'Subject', {htmlBody: body});
};
I want t send the whole table and formatting in to tha mail body I got Sheetconverter Libraries from this link Use MailApp to send formatted data from spreadsheet in htmlBody Please help me
When sending HTML in the body of an email, you need to include options specifically stating that there is an HTML body.
The
{htmlBody: body}
bit is what you where missing.Modified code: