How to use Google Apps Script and Triggers with Geckoboard

Google Apps Script is a versatile JavaScript based scripting language for use within the G Suite platform. Read more from Google on what you can do with Google Apps Scripts in this guide.

How to use Google Apps Script with Geckoboard

This guide will demonstrate how to create and use custom functions within Google Apps Script to pull data from a Google Sheet, then push that data to the Custom Widgets integration in Geckoboard. 

The native Spreadsheets integration is the best option for displaying data from a spreadsheet, however, you might consider the approach in this guide if you prefer to use a visualization type not offered within the Spreadsheets integration such as a list, map or RAG widget. 

Supported visualizations

How to push data to Custom Widgets

Tip

Get a head start by making a copy of this Google Sheet that contains all widget types supported in this guide!

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

  1. Create a new Google Sheet.
  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.

Next, return to Geckoboard and follow the steps below to create your Custom Widget.

  1. In the top right of your dashboard, click Add widget.
  2. You'll see a scrollable list of Integrations. Search for Custom Widgets using the Search sources field.
  3. Select Custom Widgets.
  4. Choose the visualization you wish to use. For this guide, we’ll select the RAG widget type.

    Important note

    Please note, only some visualizations are supported for this method. Check the Supported Visualizations section for details on which visualizations work with this guide.

  5. Set the Method field to Push.
  6. Click Add widget.
  7. Locate the widget on your dashboard and click Copy widget key.
  8. Return to your Google Sheet.
  9. Next to Widget, paste the widget key into the B2 cell.
  10. Return to Geckoboard and obtain your API key.
  11. Return to your Google Sheet and next to API Key, paste the API Key into the B1 cell.
  12. 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.
  13. In column A below the other content, add your numeric values.
  14. In column B below the other content, add your text.

Follow the steps below to 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!

How to set up Triggers

To automate the process of pushing data to Geckoboard, follow the steps below to set up Triggers.

  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!