Generate Google Doc from Template with multiple pages

Hello Friends,

I am trying to generate a Google Doc from a Google Template for mail merge jobs. But at the moment it generates multiple docs rather than one doc with multiple pages.

How can we achieve this?

Thanks!

Welcome to the Make community!

To allow others to assist you with your scenario, please provide the following:

1. Relevant Screenshots

Please share screenshots of your scenario, any error messages, relevant module fields, and filters in question? It would really help other community members to see what you’re looking at.

You can upload images here using the Upload icon in the text editor:

2. Scenario Blueprint

Please export the scenario blueprint file to allow others to view the mapped variables in the module fields. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.

3. Output Bundles of Modules

Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.

A. Upload as Text File

Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.

B. Insert as Formatted Code Block

If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:

  • Method 1: Type code block manually

    Add three backticks ``` before and after the content/bundle, like this:

    ```
    content goes here
    ```

  • Method 2. Highlight and click the format button in the editor

Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.

Following these steps will allow others to assist you here. Thanks!

Seems like what you’re looking for is more like Google Slides where you want to Create a Slide from a Template Slide. This would add a slide to an existing presentation, with the values replaced and it might even work for your use case.

The way Google Docs is built in Make doesn’t support adding filled template pages to an existing Doc, only create new docs which is what you’re experiencing now.
Under the hood, it’s doing three things:

  • Copy the template document and give it a new name specified in the module
  • Uses batchUpdate endpoint to replace all the text and image placeholders on the newly-created document
  • Get all the information about the new document

If you really wanted to do this in Google Docs, you would likely need to find a way to create a new empty document, then for each page, read in the content of the template document, make your replacements, insert that into the new document, then repeat.

1 Like