Merge multiple Google Documents

Sometime you may need to merge Google Documents together, when they are just two the task is pretty easy and involves a single copy and paste operation. In some situation where you have multiple documents to merge in a constant recurring way the copy and paste operation could become a tedious task and an huge waste of time.

For this reason I’ve created a Spreadsheet document that, with the help of Google Apps Script, will automate the Google Document merge ¬†operation for an unlimited amount of Google Documents.

First of all make a copy of the following Google Spreadsheet document: Merge multiple Google DocumentsMerge multiple Google Documents 1

To merge Google Documents you need the Document ID for each of them. Getting the Document ID is pretty easy, just open the Google Document you want to merge and look at the browser address bar:

Merge multiple Google Documents 2

The ID of the document is the string between “../d/” and “/edit”, in this example the ID is: “1uWocGqA7Bifl61Vu8-TOWpALDHic8gbc5oCuZivZ1Dg”. All you have to do is to put this ID from cell A5 of the Spreadsheet document:

Merge multiple Google Documents 3

You can add an unlimited number of document ids, just put them vertically from cell A5. When you have finished inserting all the Document ID to merge run the menu item “Merge Documents -> Merge”:

Merge multiple Google Documents 4

As result of the execution a new Google Document file will be created inside your Google Drive folder “My Drive”:

Merge multiple Google Documents 5

Right now this solution doesn’t play nice with images contained inside Google Documents. In the merged document images will result broken. This is a known Google Apps Script bug, you can find more informations here: Google Apps Script Issue: 1612. As soon as Google engineers fix this bug the script should work with images without problems. The only option for you right now, if you need to merge documents that include images, is to “star” the issue 1612 on the issue tracker to speed up the possible resolution.

Happy scripting!

Consultant, Lean Thinker, Agilist, Technology Lover. Dream: Being worth a TED talk. Project Manager in a wide variety of business applications. Particularly interested in innovation projects, as well as close interaction with costumers.

Tagged with: , , ,
Posted in Google Apps, Google Apps Script, Google Documents
9 comments on “Merge multiple Google Documents
  1. Gabriel says:

    Marcello, on the #1612 issue you mention, there is a new comment with a workaround for the images issue, try to use this:


  2. bogdan says:

    Hi Marcello,

    I made a copy of your spreadsheet but it doesn’t have the “Merge documents” menu, i’m wondering where is the issue.

  3. bogdan says:

    It worked, thank’s Marcello, you’ve created a great tool.

  4. ErikC says:

    A grateful thumbs-up. This saved me a lot of time, and will save me more in the future. Thanks!


  5. I do not get a d and an edit. I have a key after the word key and before the #gid….I pasted this key code in but it does not merge my docs…any thoughts? Thanks!

  6. Hi Marcello,

    Thanks for the script. I’ve tried as instructed – and keep getting
    “Document is missing (perhaps it was deleted?)Dismiss”
    Even though the docs are not deleted. Any ideas would be appreciated!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>