Insert an image into Google Docs

Hi guys,

I’m trying @MutedJam solution to insert an image into a Google Docs document from the Insert PNG into google doc thread.

Everything works perfectly, but I can’t get it to work with a URL coming from a previous node.

I mean, the image to insert in the Google Docs document is generated and saved in each execution of the Workflow, but I need the url inside the Body parameters request to be changed according to the URL saved in a previous set node.

How can I achieve this? All my attempts give an error… What am I missing? :face_with_raised_eyebrow:

Information on your n8n setup

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

Hey @martinhache,

The quick approach would be something like https://docs.googleapis.com/v1/documents/{{ $('set node name').item.json.documentId }}:batchUpdate

1 Like

Hi @Jon

Yes, inserting an image into Google Docs has to be done through a call to their API.

In the ‘Insert Image’ node the url of the call already has that construct. As you can see here:

The problem is when passing the url of the image you want to insert in the document. In the previous forum solution, a defined url is passed, but I can’t get this url to come defined from a previous node.

What I want to get is that the url https://www.thomasmartens.eu/wp-content/uploads/2022/08/fahmi-fakhrudin-nzyzAUsbV0M-unsplash-scaled.jpg that you see in the screenshot above is inserted by a previous set node where the complete path to the image is stored. :thinking:

Hey @martinhache,

Ah ok, So it will be the same syntax just in a different place in the node. Something like the below should do the trick.

1 Like

Thanks @Jon , it works perfectly. :wink:

1 Like

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