Import Weatherstack Data to Google Sheets

In this guide, we’ll walk through how to pull realtime weather data from the Weatherstack API directly into Google Sheets, using the API Connector add-on for Sheets. We’ll first get an API key from Weatherstack, and then set up a request to pull in weather data from Weatherstack to your spreadsheet.

CONTENTS

 

PART 1: GET YOUR WEATHERSTACK API KEY

 

  1. If you haven’t already, sign up for an account at https://weatherstack.com/product. For this walkthrough, the free plan is fine.
  2. You will automatically be directed to a quickstart page containing your API key. Keep it handy as we’ll need it shortly. That’s it! You now have access to the Weatherstack API.
    weatherstack-img1

 

PART 2: CREATE YOUR WEATHERSTACK API REQUEST URL


We’ll follow the Weatherstack API documentation to access current weather for a specific location.

  • API root: http://api.weatherstack.com
  • Endpoint: /current
  • Query String:?access_key=YOUR_API_KEY&query=LOCATION
    Query String Example:?access_key=9d7…&query=New York

Putting it all together, we get the full API Request URL:

http://api.weatherstack.com/current?access_key=9d7...&query=New York

(Of course, you’ll need to substitute in your own API key and location of interest.)

 

PART 3: PULL WEATHERSTACK API DATA INTO SHEETS


We can now enter all our values into API Connector and start importing Weatherstack data into Google Sheets.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created
    weatherstack-img2
  3. Leave the headers section blank as we don’t need any headers for this request.
  4. Create a new tab. You can call it whatever you like, but here we’ll call it ‘Weatherstack’. While still in that tab, click ‘Set’ to use that tab as your data destination.
  5. Name your request. Again we’ll call it ‘Weatherstack’
  6. Click Run and a moment later you’ll see weather data populate the Weatherstack tab in your Google Sheet:
    weatherstack-img3

 

PART 4: WEATHERSTACK API NOTES

 

    1. Locations can be identified by their name (query=New York), zip code (query=10001), latitude/longitude (query=40.7831,-73.9712), or IP address (query=153.65.8.20). While Weatherstack also provides an option to auto-identify IP address, it won’t work here as requests sent via Google Sheets always point back to Google’s own IP addresses.
    2. Append query strings units=m for metrics, units=s for scientific, and units=f for Fahrenheit. For example:
      http://api.weatherstack.com/current?access_key=YOUR_KEY&query=London&units=m
    3. Other types of weather data, including historical weather, historical time-series, and weather forecasts are available via Weatherstack’s paid plans.

Leave a Comment