Insert styled HTML content into Google Docs using n8n automation

I’m working on an n8n workflow where I need to add HTML content with proper formatting to a Google Document. My automation process creates a newsletter using an AI model, then converts the output to both markdown and HTML formats before trying to insert it into Google Docs.

The workflow includes these main steps:

  • Generate newsletter content with LLM
  • Convert content to markdown and HTML
  • Insert into Google Document

I’m using the Google Docs node in n8n with the insert operation set to add content at the end of the document body using HTML format. However, when the content gets added to the document, it appears as plain text without any formatting - the HTML tags are visible instead of being rendered as styled content.

What’s the correct approach to insert HTML content into Google Docs through n8n so that the formatting is preserved? Should I be using a different content type or configuring the node differently?

yea, this is a common issue with google docs auto. try switching to markdown in your n8n node - it usually formats better. or you could use a webhook to trigger a google apps script for parsing html. way simpler than dealing with each html tag manually.

Google Docs API doesn’t support direct HTML insertion - it treats HTML as plain text, which is why you’re seeing raw tags instead of formatting. You need to parse your HTML and convert it to Google Docs’ structured request format. Instead of inserting HTML directly, break your content into individual formatting operations using batchUpdate. So <b>text</b> becomes separate requests: insert text, then format bold. Another option is using Google Apps Script as a middleman. Apps Script handles document manipulation better and can parse HTML before applying formatting. I’ve used this approach successfully when the standard API couldn’t handle complex formatting efficiently.

This happens because Google Docs API doesn’t understand HTML markup - that’s why your tags show up as plain text instead of actual formatting. I’ve hit this same wall before. The basic Google Docs node in n8n is pretty limited, so you’ll get better results using direct HTTP requests to the Google Docs REST API. You’ll want to use the documents.batchUpdate method with textStyle and paragraphStyle objects. For anything complex, I’d build a mapping function that converts your HTML elements into proper Google Docs formatting requests. It’s more work upfront, but your formatting will actually work correctly.