How to replace images within a template document in Zapier

Relay.app is an automation tool that lets you automate actions across Google Docs, Google Drive, and many other apps. In this guide, we'll show you how to use Relay.app to automatically run the Google DocsCopy doc & fill in {{placeholders}}” action for each Google DriveFile added to folder” event.
Google Drive logoGoogle Drive > Google Docs
Trigger
Last triggered
Google Drive logoFile added to folder
Google Docs logoCopy doc & fill in {{placeholders}}
1

Create a template document in Google Docs

If you don't have a template document already, create one in Google Docs. Tip: use the docs.new shortcut (did you know relay.new also exists? 😊)

What is a template document? It's a document that contains one or more {{placeholder}} tags wrapped in curly brackets. These documents are often used for templates for invoices, customer agreements, meeting notes, etc. These documents may also contain images that can be replaced

2

Add a 'Copy doc & fill in {{placeholders}}' action

Once you have a template document, add the Copy doc & fill in {{placeholders}} action to your playbook

3

Configure the action

Next, we'll configure the Copy doc & fill in {{placeholders}} action:

  • First, we'll select our template document in the Template to copy picker
  • Second, we'll define the naming pattern for all newly created copies from this template. We'll want to use some variable fields in the name of the new document. It's common to include a date or timestamp. In this case, we'll just use the name of the image file that was added to Google Drive that triggered the playbook.
  • And finally, we select all the {{placeholder}} tags and images that we want to replace for each copy that's made
4

Specify the new value of the placeholders tags and images

Because our example template was simple and short, this will be quick.

  • We'll use the Title of the newly uploaded image in Google Drive as to replace the {{file name}} placeholder in our template
  • We'll use the actual file to replace the placeholder image in the document. Note that while in this case the file is coming from Google Drive, it can come from any other app that your playbook integrates with.

And that's it! Every time this playbook runs, a copy of the Google Document will be made and the placeholder tag and image will be replaced with the name and contents of the image that was uploaded to Google Drive.

Let's add one more step that shows how you can easily use and export the Google Document in various formats.

5

Export the Google Document to PDF or XLSX (Microsoft Word)

As it's not always desired to use a Google Document as the final output, it's very easy in Relay to export a Google Document to e.g. a PDF or XLSX (Microsoft Word) file. Various other formats are supported as well.

To do so, add any automation where you want to attach, insert or upload a file. In this example, let's send an email via Gmail.

The Attachments dropdown shows all file variables that are available in the playbook. You'll also see the newly copied Google Document listed there, with various export formats in the submenu. From here, you can pick PDF, Microsoft Word (XLSX), or any other format including HTML and even EPUB!

Google Docs logo Google Docs
More information
Google Drive logo Google Drive
More information

What will you automate?

Sign up and get started with your first Relay.app playbook today.
Background image