Google Docs: replace {{photo}} with an image via n8n

Hi! I want to replace the {{photo}} placeholder with an image in a Google Doc. The image comes from an n8n form. I’m stuck—any ideas?

Welcome to :n8n: community @TOUFIQ_Bilal,

You can’t achieve this with the built-in Google Docs node because it doesn’t support inserting images..
Instead, you’ll need to call the Google Docs API directly:
first find the placeholder {{photo}} and its index, delete the placeholder, then insert the image at that index.

Fortunately, I’ve done this before and can share the workflow with you,

Here it is:


:point_right: If this solves your problem, feel free to mark the reply as the solution :white_check_mark: it’ll help others with same issue, and it also helps me on the leaderboard :folded_hands:t2:

“Perfect, it works, but I noticed it doesn’t work when I put {{photo}} inside a table. Would you have a solution?

1 Like

Hi @TOUFIQ_Bilal, glad it works,

here is another version that supports when placeholders are inside a table

You can just ask any AI to edit the Code node, this is the core logic..


Please do not forget to mark the reply as the solution :white_check_mark: it’ll help others with same issue, and it also helps me on the leaderboard :folded_hands:t2:

2 Likes

@TOUFIQ_Bilal does everything work now?

1 Like
thank you for your help mohamed3nan

1 Like

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