Inserting HTML content with formatting into Google Docs using n8n workflow

I’m working on an n8n automation where I need to insert HTML content into a Google Document while preserving the formatting. My workflow generates content using an AI model, converts it to HTML format, and then tries to add it to a Google Doc.

The issue I’m facing is that when I use the Google Docs node to insert the HTML content, it appears as plain text without any formatting. I’m using the insert operation with the HTML option selected, but the output document shows raw HTML tags instead of formatted text.

I also have the content available in markdown format if that would work better. Has anyone successfully inserted formatted content into Google Docs through n8n? What’s the correct approach to maintain formatting when adding HTML or markdown content to a Google Document via the n8n Google Docs integration?

had the same prob last month. use pandoc to convert html to google docs format first - there’s a pandoc node u can grab. works way better than jamming html straight into the docs api. also make sure your html is clean - weird tags will break conversion.

The Google Docs API doesn’t support direct HTML insertion, which is why you’re seeing raw HTML tags instead of formatted text. The n8n Google Docs node relies on the API’s document.batchUpdate method, specifically designed for Google’s document structure, not HTML. A workaround would be to convert your HTML into Google’s native format first. Use the Google Docs node to insert the text with specified formatting like bold, italic, or font size. However, you’ll need to break down your HTML into individual components and make separate API calls for each. Alternatively, consider using Google Apps Script as an intermediary. You can create a script that processes your HTML content with HtmlService and applies the formatting directly to the document. Trigger this script from n8n via the HTTP request node, which handles complex HTML structures more efficiently than the standard node.

Skip HTML and convert your markdown straight to Google Docs format - way more reliable. I built a custom function that parses markdown and maps it to Google Docs API structure. Each markdown element needs to match a specific Google Docs formatting object. Bold becomes a textRun with bold weightedFontFamily, headers become paragraphs with namedStyleType. Build your batchUpdate request with structuralElements instead of trying to insert formatted strings. Break content into individual formatting runs rather than bulk operations - works much better. Takes more setup upfront but handles complex formatting way better than trying to jam HTML in there.

The n8n Google Docs node does not render HTML or Markdown—it only inserts content as plain text, even if “Insert as HTML” is selected. That’s why raw HTML tags appear.

To keep formatting:

Use the Google Docs API (documents.batchUpdate) via an HTTP Request node and convert HTML/Markdown into structured text + styles.

Or use Google Apps Script to handle the HTML/Markdown conversion and trigger it from n8n.

This video explains the correct approach clearly:
:backhand_index_pointing_right: https://youtu.be/rzahBPv5v_A