Remove manual processes from your workflow by automating tasks.
Don’t close the browser tab with the Google Sheet, or the Script Editor will close as well.
Add Tag Manager API to the project
Copy the Apps script source code and replace everything in the Script Editor Code.gs file with the source code.
Copy the source code and replace everything in the Script Editor Code.gs file.
Select onOpen from the list of script functions, then click Run to execute the extension code and add it to the Sheets Add-ons menu.
Select onOpen and then click Run
Click through the prompts to authorize the Sheet’s access to your GTM container. If you see a warning about an unverified app, expand the error message and click the link that says Proceed.
Go back to the browser tab with the Google Sheet and locate your add-on in the Add-ons menu once the script has run successfully.
The name of the Add-on will be whatever you named the project.
Click the Build Hierarchy option in the Add-ons menu to automatically create a new sheet named GTM Hierarchy populated with the Google Tag Manager accounts and containers you have access to.
If you run into a quota or query limit error, log in with a Google Account that has access to a smaller number of containers.