I am using search and replace to build a report in google doc. Hassle I am having is some of the text I am inserting into the google doc is in markdown. When n8n inserts the text into the google doc the mark down is not working, ie I am not getting the formatting I expect. I have turned on the mark down feature in Google doc but that only works for mark down created in google doc and does not apply to mark down inserted from an n8n work flow.
I have tried converting the the mark down to HTML and inserting that, but then I get raw HTML in the Google doc.
Any one have a clever idea of how to get google docs to reflect the intended formatting? I figure the answer lies in doing something in n8n rather than some google doc configuration.
Get an answer to a prompt from the Open AI. The answer for the AI is in Mark down format.
Use the google doc node and the search and replace feature to look for a merge token, for example {{AI_CONTENT}} and replace that with the text in mark down formta supplied by the AI.
Result - The text is inserted in the gogle doc but as raw markediwn and not formatted.
Steps I have tried to fix this
Turning on Markdown functionality in Google docs - only works when the marje down format is entered directly into the google doc. Copy and paste or insert via API does not render mark down.
Convert Markdown to html in n8n and insert raw html. Same issue, HTML is not rendered in the google doc.
Create a google apps script to force html or mark down to render. This might be where success lies but I have not been able to get it to work yet.
I am hoping there might be something I can do to the mark down text inside if n8n before inserting it that might get google docs to show the intended format provided by the mark down or html. Or perhaps some intermediary node that will do the same.
Here is what the output looks like when inserted into the doc.
Hi @Robm I had a deeper look into this because I was admittedly a bit mistaken - while Google Docs does support markdown, it only works if you are manually typing it in. It will not work if you paste in markdown.
While the Google Docs node doesn’t support tables, you may be able to get what you’re looking for via the HTTP Request node and manually sending over something that matches this data structure for their API: Working with tables | Google Docs | Google for Developers
However, if you aren’t tied to Google Docs specifically, it might be best to consider using Sheets instead for this, as the formatting you’re looking for might be much easier to achieve