title: Google app script - attach/embed document into email
body: <p>Is there a good way to embed a Google Document into an email?</p>
  
  <p>I can start with:</p>
  
  <pre><code>var doc = DocumentApp.openById('1P_KZr_xpg.....xntBqvQ');
  </code></pre>
  
  <p>I've tried these approaches:</p>
  
  <p>A) <code>MailApp.sendEmail('john@abc.com', doc.getName(), doc.getText());</code>
  The raw text from the document forms the body of the email... all formatting is lost.</p>
  
  <p>B) <code>MailApp.sendEmail('john@abc.com', doc.getName(), doc.getUrl());</code> 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.</p>
  
  <p>C) <code>MailApp.sendEmail('john@abc.com', doc.getName(), '', { htmlBody: HtmlService.createHtmlOutput(doc.getAs('blob') });</code> This seems promising, but gives an error: "Unsupported conversion requested."</p>
  
  <p>Is there any other way to embed a document?</p>
  
  <p>Is there any way to get the HTML version of a document?  Once I have that, I can use <code>htmlBody</code> to insert it.</p>