Use Google Apps Script and Triggers with Geckoboard

By using custom functions within Google Apps Script to pull data from a Google Sheet, you can push that data to Custom Widgets in Geckoboard. This approach can come in useful when you want to use one of the following visualization types not supported by our dedicated Spreadsheets data source:

Step 1: Prepare your Google Sheet

To set up your Google Sheet from scratch, follow the steps below.

  1. In Google Sheets, either create a new sheet or make a copy of this pre-prepared sheet which contains all widget types supported in this guide.
  2. In the cell A1, add the word API Key.
  3. In the cell A2, add the word Widget.
  4. In the cell A3, add the word Type.
  5. Navigate to Tools, then click Script editor.
  6. Delete the existing default code.
  7. Copy and paste all of the code from this GitHub Gist into the Script editor.
  8. Click the Save button.
  9. When prompted, assign a project name and click OK.

Step 2: Create your Custom Widget

Next, we'll return to Geckoboard to create your Custom Widget.

  1. Add a new Custom Widget from your dashboard.
  2. Choose the visualization you wish to use. For this guide, we’ll select the RAG widget type. Only some visualizations are supported for this method.
  3. Set the Method field to Push.
  4. Click Add widget.
  5. Locate the widget on your dashboard and click Copy widget key.
  6. Return to your Google Sheet.
  7. Next to Widget, paste the widget key into the B2 cell.
  8. Return to Geckoboard and obtain your API key.
  9. Return to your Google Sheet and next to API Key, paste the API Key into the B1 cell.
  10. In the B3 cell next to Type, add the type of widget visualization you are using. Since the RAG widget type was selected for this guide, type RAG in this cell.
  11. In column A below the other content, add your numeric values.
  12. In column B below the other content, add your text.

Step 3: Run the script

Now we'll run the script and push the data to Geckoboard.

  1. Open the Script editor. 
  2. To run the script, click the Play button.
  3. Next, click Review Permissions.
  4. Follow the on-screen steps to select or sign into a Google account. 
  5. To permit the script to run, when prompted, click Allow.
  6. Return to your dashboard and view your widget!

Step 4: Automate with triggers

Finally we'll use triggers to automate the process of pushing data to Geckoboard.

  1. In the Script editor, click Edit.
  2. Then select Current project's triggers.
  3. In the bottom left of the page that automatically opens, click + Add Trigger.
  4. In the Choose which function to run field, ensure that main is selected.
  5. In the Choose which deployment is run, ensure that head is selected.
  6. In the Select event source field, choose the type of trigger you desire. We recommend the Time-driven option.
  7. Fill in any other fields with your desired parameters.
  8. Click Save. Your script will now trigger and run automatically!

More Resources

Was this article helpful?

Awesome! 👍 Thanks so much for your feedback!

Sorry about that! Start a conversation now.

Ready to create your own dashboard?

Get started for free

Still have questions? Get in touch.