4

I am using Apps Script to create Google Docs. The Apps Script has been deployed as an API Executable. The Apps Script receives the request json, which it writes to the Google Doc. I am able to create and print the values from input JSON as String in Google Doc.

The input JSON has some of the properties whose value is HTML. How can I render the HTML in Google Doc using Apps Script?

Rubén
  • 34,714
  • 9
  • 70
  • 166
Mithun
  • 7,747
  • 6
  • 52
  • 68
  • You have the same scenario in this [SO post](https://stackoverflow.com/questions/35044843/render-html-to-a-google-doc-using-app-script), the answer here maybe helpful. – MαπμQμαπkγVπ.0 Sep 27 '17 at 12:18
  • I think this answer talks about something else, Mithun, were you able to figure out a solution for this? – Mavi Domates Sep 04 '20 at 11:07

1 Answers1

1

Google Apps Script and the Google Docs API doesn't a built-in way to directly render HMTL and add the resuling display to the Google document.

The answer to Render HTML to a Google Doc using app script? offer a workaround: convert an HTML doc to a Google Document by using the Google Drive Advanced Service.

  1. Create an HTML and upload it to Google Drive
  2. Convert the HTML file to a Google Document format
  3. Get the content of the above Google Document and insert / append it to the document target.

Another option could be to use a third party service or a JavaScript library that does the HTML rendering.

Rubén
  • 34,714
  • 9
  • 70
  • 166