Is there a good way to embed a Google Document into an email?
I can start with:
var doc = DocumentApp.openById('1P_KZr_xpg.....xntBqvQ');
I've tried these approaches:
A) MailApp.sendEmail('[email protected]', doc.getName(), doc.getText());
The raw text from the document forms the body of the email... all formatting is lost.
B) MailApp.sendEmail('[email protected]', doc.getName(), doc.getUrl());
The URL to the document is the body of the message. The content of the document is not seen until you click through to the source document.
C) MailApp.sendEmail('[email protected]', doc.getName(), '', { htmlBody: HtmlService.createHtmlOutput(doc.getAs('blob') });
This seems promising, but gives an error: "Unsupported conversion requested."
Is there any other way to embed a document?
Is there any way to get the HTML version of a document? Once I have that, I can use htmlBody
to insert it.