Extending Simo Ahava's Superb GTM Tools for Google Sheets

Documenting the inner workings of Google Tag Manager in a way that makes the whole affair seem less magical is a tall order for any GTM magician.

Even if your main audience is other analysts and Analytics Managers, there are likely to be a lot of raised eyebrows in the room when the owner of the Google Tag Manager implementation starts spouting terms like "container size" and "trigger groups."

We recently met with that challenge, and the first search result that came to our rescue was Simo Ahava's excellent 2017 Google Sheets add-on for GTM documentation building.


The Next Mile

But alas, it was soon revealed that our heroes may not be able to cut across the stubborn thickets of complexity and save the last great dragon.

One of the features we found we needed very early on was being able to pull a history of published container versions, each with their description. There is now a new option under Build Documentation:


For Google Sheets documenting multiple containers, it quickly became tedious to have to re-select the source account and container when updating the documentation. A new "Quick Rebuild" option selected inside any tab with the format "GTM-<ID>_container" will refresh all tabs belonging to said container:


The audience for our Google Sheet is not familiar with GTM, and to be honest, we ourselves couldn't make heads or tails of the numeric Trigger ID's under Tags, and the numeric folder id's in asset tabs. Resolving the ID's to the actual Trigger and Folder names made these tabs less likely to baffle our audience, and more helpful for us to run searches on:


Other Enhancements:

  • A safer way to push comments / annotations to a GTM workspace.

  • Support for moving tags / triggers / variables in and out of folders.

  • Sanitized and abridged JSON fields so they can be more useful to inspect element definitions.

  • Optimized some workflows to be quicker, e. g. no prompt when highlighting pending changes.

  • Automatic throttling of API requests to stay under the rate limits set by Google, with a nice progress indicator.


In the future plans for this fork, topping our wish list is the ability to sync up individual elements safely and easily from one container to another.

Before we share the steps to install the GTM Tools for Google Sheets fork, we should let users of the existing Simo Ahava add-on know that it's very likely they'll see some of these features make it into the main branch without having to do anything.

Steps to Install:

1. Install the Google Apps Script Chrome add-on for GitHub:


2. Clone the QA2L fork of Simo Ahava's GTM Tools from the link below into a new Apps Script ( project:


3. In your new project, enable the Google Tag Manager API under Resources > Advanced Google Services:


4. Select Run > Test as add-on... to embed and run the add-on code inside any existing Google Sheet of yours.

5. If you modify the code, please remember to contribute to the open source greatness of it all.


Tags: Data Governance Blog Google

Subscribe to our quarterly data quality newsletter