OpenWeatherMap is a global weather data API that you can use to get current and historical weather data, forecasts, and more.

In this tutorial, you will learn how to connect the OpenWeather REST API to Google Sheets in 5 steps:

  1. Install the Apipheny Add-on
  2. Obtain an API Key
  3. Obtain an Endpoint URL
  4. Enter OpenWeather API into Apipheny
  5. Run the OpenWeather API request
💡 Related article: Import data from WeatherStack 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.) Get your OpenWeather API Key

After you’ve signed up for an OpenWeather account and verified your email, a confirmation email with your API key and technical instructions will be sent to your email address:

Email from OpenWeather with API key
Email from OpenWeather with API key

Please note that it could take up to 2 hours to activate your API key.

Step 3.) Choose your OpenWeather API endpoint

In this section, we’ll show you how to browse the OpenWeather API documentation to find the API URL that will retrieve the weather information that you need. If you already know your URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the OpenWeather API documentation page: https://openweathermap.org/api

This page contains a structured view of the available APIs, each with an accompanying description:

OpenWeather API documentation
OpenWeather API documentation

Below the list of available APIs, there’s a section containing links to each API and to each of the API’s corresponding endpoints:

OpenWeather APIs and endpoints
OpenWeather APIs and endpoints

Clicking on an API opens a dedicated page for that API, containing the list of associated endpoints. A menu on the right side of the page presents a grouped view of this list. For instance, the page for Weather Alerts lists its 15 available endpoints: Create trigger, Create alerts by trigger, all the way to History alerts:

Weather Alerts API documentation
Weather Alerts API documentation

All API calls to OpenWeather should be made to the https://api.openweathermap.org/data/3.0/ base domain.

OpenWeather API root/base URL:

https://api.openweathermap.org/data/3.0/

An example endpoint is Get triggers, so here’s what the URL would look like for this endpoint:

http://api.openweathermap.org/data/3.0/triggers

The documentation for each endpoint contains the HTTP method used (eg. GET), the link you should append to the root API URL for querying this endpoint (eg. /triggers), a short description of the endpoint’s purpose, and a response example:

OpenWeather Endpoint Documentation
OpenWeather Endpoint Documentation

The description of the available parameters and of the returned data structure is provided as a link to a separate page, for example, https://openweathermap.org/triggers#triggers_struct:

OpenWeather API endpoint documentation
OpenWeather API endpoint documentation
OpenWeather API endpoint parameters
OpenWeather API endpoint parameters

Step 4.) Enter the OpenWeather API request into Apipheny

Go back to your Google Sheet and make sure that the Apipheny add-on is open to 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) required by your API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the OpenWeather API endpoint that you need. Now copy the complete 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 will obtain the current weather for a specific city, and this is the API URL we will use:

https://api.openweathermap.org/data/2.5/weather?q=city_name&appid=your_api_key

Where city_name represents the name of the city you want the current weather for, and your_api_key is the key emailed to you in Step 2.

In this example we chose Chicago as the city_name.

 Headers aren’t required for this API request, so you can leave that section blank in Apipheny.

OpenWeather API request entered in Apipheny
OpenWeather API request entered in Apipheny

Step 5.) Run the OpenWeather API Request

Finally, click the Run button at the bottom of the Apipheny add-on and then wait for the OpenWeather API data to be added to your Google Sheet:

Weather API data in Google Sheets
Weather API data in Google Sheets

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

💡 Related article: Import data from WeatherStack 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?