Is there a way to put a Google document in an email?
I can start with:
var doc = DocumentApp.openById('1P_KZr_xpg.....xntBqvQ');
I tried these approaches:
A) MailApp.sendEmail(' john@abc.com ', doc.getName(), doc.getText()); The raw text from the document forms the body of the letter ... all formatting is lost.
B) MailApp.sendEmail(' john@abc.com ', doc.getName(), doc.getUrl()); The document URL is the body of the message. The contents of the document are not displayed until you go to the original document.
C) MailApp.sendEmail(' john@abc.com ', doc.getName(), '', { htmlBody: HtmlService.createHtmlOutput(doc.getAs('blob') }); This seems promising, but gives the error: "Unsupported conversion requested. "
Is there any other way to embed a document?
Is there a way to get the HTML version of a document? After that, I can use htmlBody to insert it.
source share