I’m working on an automated workflow using n8n and running into formatting issues. My setup generates blog content with AI, converts it to HTML format, and then tries to insert it into a Google Doc. The problem is that when the HTML gets added to the document, all the formatting disappears and it shows up as plain text instead of keeping the styles like bold text, headers, and lists. I’ve tried using both HTML and markdown formats but neither seems to work properly. The Google Docs node in n8n appears to strip out all the formatting when inserting content. Has anyone found a way to preserve HTML formatting when adding content to Google Docs through n8n? What’s the correct approach to maintain text styling in this automation?
google docs api is a real pain with formatting. what i did was start with plain text, then send another request to format it. its annoying, but i turn html tags into google’s formatting way. yeah, it takes longer, but at least the styles stick.
You can’t just dump HTML directly into Google Docs through n8n - learned this the hard way after weeks of banging my head against the wall. Google Docs API wants batch update requests with specific formatting objects instead. Here’s what actually works: insert your plain text first, then hit it with separate batchUpdate operations for each text range you want to format. Every style (headers, bold, whatever) needs its own format request with startIndex and endIndex params. It’s messier than you’d expect, but you get exact control over the formatting. Pro tip: preprocess your HTML to pull out the text content and formatting instructions separately before sending everything to the API.
Had this exact problem six months ago building a content pipeline. Google Docs API won’t take HTML directly - it wants structured requests with specific formatting commands. I fixed it by adding a Function node in n8n to parse HTML and convert it to Google Docs format. You’ve got to break down your HTML into separate API calls for each formatting element. Bold text needs its own textStyle property in the request body. It’s tedious, but I wrote a JavaScript function that maps common HTML tags to Google Docs equivalents. Makes the workflow longer, but formatting finally works. Also tried using Google Apps Script as a webhook to handle HTML conversion - actually ran smoother than doing everything in n8n.