Skip to main content
Create a weather widget using Google Sheets

Steps to build a widget displaying temperature and weather using weatherstack data.

Updated over 8 months ago

To create a weather widget using Google Sheets, follow these steps:

  1. Make your own copy of this Google Sheet template.

  2. On cell A2, enter your city as "City, CO" where City is the name of your city and CO is a two-letter code identifier of your state (if in the US), or a two-letter code identifier of your country (if outside of the US). For a US city, you could enter New York, NY. For a city outside the US, you could enter London, UK.

  3. On cell A5, enter your API Access Key for weatherstack (which you can find at https://weatherstack.com/dashboard?logged_in=1).

  4. On cell A9, enter m to get the temperature in °C or f to get the temperature in °F

  5. Click on the Tools menu and select the option Script editor.

  6. You'll see a script. Click on the project's trigger's menu.

    Add a trigger to your Apps script
  7. Click the + Add Trigger button in the bottom right corner of the page.

    add_trigger.png
  8. Set a trigger for the myFunction function, that runs from Head on a Time-driven source that's triggered on an Hourly timer.

    Set the trigger
  9. Once you set the trigger (and so that you don't have to wait 1 hour to get data), run the script for the first time

    Run the function
  10. That will retrieve (on cells D2 and D3) the weather for the city you entered on cell A2 on an hourly basis. You can use that weather data and our Spreadsheets data source to build a text widget using the concatenated cell D4 for your dashboard that will update hourly.

    Now you'll know if you need the umbrella when you're heading out.

    Weather widget

Tip

There are alternatives to Weatherstack you might want to try. This helpful article reviews several weather APIs that, used in conjunction with Google Sheets' =ImportData() function to retrieve JSON data, can pull detailed weather forecast data to a Google Sheet.

Turn spreadsheet data into shareable dashboards
Did this answer your question?