How to integrate the Weatherstack API with Google Sheets

Weatherstack is a weather API from the API provider Apilayer. The Weatherstack API is designed to provide weather updates for anyone who needs them. We can use the Weatherstack API to display current, past, and predicted weather data in Google Sheets. In this tutorial, we’ll show you how to connect the Weatherstack REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Obtain an API key
  3. Choose a Weatherstack API Endpoint
  4. Enter the Weatherstack API request into Apipheny
  5. Run the Weatherstack API Request in your Google Sheet
💡 Related article: Import data from OpenWeather into Google Sheets

Step 1.) Install and open the Apipheny add-on for Google Sheets

Apipheny is an API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to unlimited API data sources, make unlimited API requests, and more. There is a 30 day free trial included.

1.) Install Apipheny by opening the following link on desktop and then clicking the Install button in the Google Marketplace: https://apipheny.io/install

2.) After you’ve installed Apipheny, open a Google Sheet and then click on the Extensions dropdown in the menu at the top.

In the dropdown list you should see Apipheny. Click Apipheny then click Import API to open the Apipheny sidebar in your Google Sheet.

open apipheny

Tip: you can open a new Google Sheet by entering this URL in your browser: sheet.new

Step 2.) Obtain an API key

After signing up for the Weatherstack API, a page containing your API Access Key will be displayed:

Weatherstack dashboard
Weatherstack dashboard

Copy and paste your API Access Key in a safe location because you’ll need it in the next steps.

Step 3.) Choose a Weatherstack API endpoint

In this section, we’ll show you how to browse the Weatherstack API documentation to find an API endpoint that retrieves the specific information you need from the Weatherstack API. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the Weatherstack API documentation page: https://weatherstack.com/documentation

The menu on the left contains general information about the Weatherstack API and a list of API endpoints:

Weatherstack documentation page
Weatherstack documentation page

In this example, we will describe the Historical Weather endpoint, that is used to look up historical weather data all the way back to 2008. The whole URL for this endpoint is:

http://api.weatherstack.com/historical?access_key=YOUR_ACCESS_KEY&query=CITY&historical_date=DATE&hourly=1

The documentation for this endpoint contains a short description of the endpoint’s purpose, the accepted path parameters and the responses it can return:

Historical Weather endpoint documentation
Historical Weather endpoint documentation

All API calls to the Weatherstack API should be made to the http://api.weatherstack.com/ base domain. All endpoints and parameters should be appended to this base domain.

Step 4.) Enter the Weatherstack API request into Apipheny

Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on the “Import” tab. With the Import Tab open, enter these details into the add-on:

Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) as required by your Weatherstack API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the Weatherstack API endpoint that you need. Now copy the complete API URL into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.

For this example, we are using the Current weather endpoint that returns the current weather for a specific city. The corresponding URL for this endpoint is:

http://api.weatherstack.com/current?access_key=ACCESS_KEY&query=CITY

If you use this same URL, don’t forget to replace ACCESS_KEY with the value you previously obtained in Step 2, and replace CITY with a real city name.

Headers are not required for this API request, so you can leave this section blank in Apipheny.

Here’s what our request looked like when entered into Apipheny.

Weatherstack API request entered into Apipheny
Weatherstack API request entered into Apipheny

Step 5.) Run the Weatherstack API request in your Google Sheet

The last step is to click the Run button at the bottom of the Apipheny add-on and then your Weatherstack data will be imported into your Google Sheet, like so:

Weatherstack data imported into Google Sheets
Weatherstack data imported into Google Sheets

After making a successful request to the Weatherstack API, try querying a different Weatherstack API endpoint, or try using one of the more advanced features in the Apipheny add-on.

💡 Related article: Import data from OpenWeather into Google Sheets

Crypto API tutorials and more:


API Tutorials



API Knowledge

What is an API?
What is an API URL?
What are parameters?
What is an endpoint?
What is an API key/token?
What is basic authentication?
What are headers?
What is a GET request?
What is a POST request?