Adding HTML content with proper formatting to Google Docs using n8n automation

I’m working on an n8n workflow that creates content using an AI model, then converts it to HTML format, and finally needs to insert it into a Google Doc. The automation pipeline works like this: first I generate a newsletter with an LLM, then transform it into HTML markup, and lastly try to add it to a Google document.

I’m using the Google Docs node in n8n and selecting the insert option to add content at the end of the document. I have the content type set to HTML in the configuration.

The problem is that when the HTML gets inserted into the Google Doc, it shows up as plain text instead of keeping the original formatting. All the HTML tags are visible as text rather than being rendered as formatted content.

Is there a specific way to configure the Google Docs node in n8n so that HTML content maintains its formatting when inserted? I also have the same content available in markdown format if that would work better for this use case.

I had the same issue when building automated reports. Skip the built-in Google Docs node and use the batch update API through n8n’s HTTP Request node instead. You can send structured requests that handle formatting properly - paragraph styles, text formatting, tables, all of it. The trick is converting your HTML elements into Google Docs’ specific request format. Bold text becomes a textStyle object with bold: true, for example. More work upfront, but you get real control over formatting instead of just dumping plain text. Check the documentation for examples of how to structure batch requests for different formatting.

yeah, google docs kinda struggles with html n stuff. might be better to convert your html to rich text format before putting it in. also check the api for any rich text options that might help you out!

The Google Docs API doesn’t support direct HTML insertion - it just treats HTML as plain text. That’s why you’re seeing this behavior. I’ve hit this same issue before. You need to parse your HTML first, then convert it to structured requests using insertText with textStyle objects for bold, italic, etc. Since you’ve got markdown, you could also parse that and apply formatting through the API’s textStyle parameters. The trick is breaking your formatted content into separate text runs with their own styling rather than trying to dump raw HTML into the node.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.