Create google doc with dynamic values

Hi,

I would like to create a workflow that take some rows into my airtable database and create a document from a google doc template (already created in my drive) replacing my parameters into the doc (i.e {{company_name}} ) by the values into my airtable database. I can duplicate the doc thanks to the google drive node but I can’t find the option to fullfill the values. Do you have any ideas how I could do it ? I also tried to create the document and then update it but it was not successful. Thank you :slight_smile:

My setup :
Running version [email protected]

Hi @jeremy_FRANCOIS, I think the simplest way to achieve this would be to first copy the document (which by the sounds of it you already managed to do) and then replace text as needed.

For example, if my document looks like this:
image

I can simply use the search and replace action in the Google docs node like so:

Afterwards, my document is updated as expected:
image

Obviously, in your case you don’t want to set a hardcoded value like above, but you can simply use an expression to link your Airtable data (provided you have read it in a previous node).

Let me know if you have any trouble here!

2 Likes

Thanks @MutedJam ! it works perfectly for my google doc ! I’m going to try it for a google slides presentation. Thanks again !

1 Like

is it work too for replacing an image?

Unfortunately, no. I asked for the development of this feature for google slides too

Finnaly i found the way to replace the image, using http request node to google doc api
https://docs.googleapis.com/v1/documents/{{$node["Google Docs"].json["documentId"]}}:batchUpdate

RAW Json parameter:

{
  "requests": [
    {
      "replaceImage": {
        "imageObjectId": "<this-is-image-id-from-your-google-doc>",
        "uri": "{{$node["Google Drive1"].json["webContentLink"]}}",
        "imageReplaceMethod": "CENTER_CROP"
      }
    }
  ]
}
1 Like

I want to know where to get the image ID from the document or Google slide.

If this feature to replace image is added to all Google Docs, Sheet and Slide it will be such a game changer especially with GSlides!!

Its a humble request to develop this feature!