Having trouble with text inserted into google docs and mark down

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.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Forgive the bump,

Is there anyone who knows how to tackle this challenge?

Hi @Robm :wave: Sorry for the late reply on this!

Could you share your workflow with us, and an example of what you’re seeing happen in your google doc that you aren’t expecting?

Can you also let us know what version of n8n you’re running? The questions asked above are helpful in troubleshooting!

Sure thing, sorry for the delay in replying.

In words 1st.

  1. Get an answer to a prompt from the Open AI. The answer for the AI is in Mark down format.
  2. 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.
  3. Result - The text is inserted in the gogle doc but as raw markediwn and not formatted.

Steps I have tried to fix this

  1. 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.
  2. Convert Markdown to html in n8n and insert raw html. Same issue, HTML is not rendered in the google doc.
  3. 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.

image

This is the result I am looking for

image

Self hosted n8n on the lang chain beta

Hi @Robm :wave: 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 :see_no_evil:

1 Like