I had a wild idea that I could build a website blog for an unsophisticated user friend using Google Drive Documents to back it. I was able to create a contentService that compiles a list of documents. However, I can't see a way to convert the document to HTML. I know that Google can render documents in a web page, so I wondered if it was possible to get a rendered version for use in my content service.
Is this possible?
You can try this code :
There is no direct method in GAS to get an HTML version of a doc and this is quite an old enhancement request but the workaround described originally by Henrique Abreu works pretty well, I use it all the time...
The only annoying thing in the authorization process that needs to be called from the script editor which makes it uneasy to use in a shared application (with "script unable" users) but this only happens once ;).
There is also a Library created by Romain Vialard that makes things (a bit) easier... and adds a few other interesting functions.
You may use the solution here
Pass as fileId, the id of the google doc and to enable advanced drive services follow the instructions here.
Node.js Solution
Here's how you can get a google doc as html using google drive's node.js client library.
Take a look at the Google Drive V3 download docs for more languages and options.
Note that the Google APIs Node.js Client is in alpha (January 2017).
Perhaps this would work for you...
Here is a little snipped for the new version of goole AOuth following the idea posted by Enrique:
and then use the usual mailApp:
Hope the new workaround helps
JD