All Collections
Integrations
API
Gtmhub Account Data: Google Sheets Script
Gtmhub Account Data: Google Sheets Script

Google Sheets Script which uses the Gtmhub API to pull Account Data

Neli Ivanova avatar
Written by Neli Ivanova
Updated over a week ago

Gtmhub provides a flexible API, allowing you to both send data to Gtmhub as well as retrieve information from Gtmhub.  This example will show how to use the Gtmhub API with Google Sheets to automate the pulling of Gtmhub Account Data. 

Google Sheets Template

First step is to copy this Gtmhub Account Data Template to your Drive.  It will include all Sheets needed to save your data, as well as the script to pull data from the API.

Update Script 

Included in the Template is a Script (Tools > Script Editor) that exports Gtmhub Account Data and saves it back to the Sheet.  In order for this to work with your Account, you will need to update the Script with your API Token, Account ID, and Data Center..  (If you haven't already, view the API Setup Guide).

At the top of the script are variables for your API Token, Account ID, and Data Center..  Update these variables with your corresponding values.

Run Script 

Now that you have the Sheet copied to your drive, and you have updated the Script with your API Token and Account ID, you can execute the Script.  Run the main function, and ensure there are no errors.  If successful, the Sheet should be updated with your account data.

Automate Script 

Sheets Scripts comes with a build in Timing Triggers.  Click the Clock icon in the Script menu, and configure a timer to run at your desired interval.  The example below runs every hour.

Use as Gtmhub Data Source

Gtmhub allows you to create custom insights from over 150 Data Sources, including Google Sheets.  This means you can create Automated Key Results using your Gtmhub Account Data.  Some examples:

  • % of Objectives above 70% Attainment

  • % of Employees that own an OKR

  • % of Key Results updated per Cadence

Did this answer your question?