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:
Apipheny is a free API connector for Google Sheets. You can use Apipheny to connect your Google Sheets to API data sources, easily.
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.
Tip: you can open a new Google Sheet by entering this URL in your browser:
Please note that it could take up to 2 hours to activate your API key.
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:
Below the list of available APIs, there’s a section containing links to each API and to each of the API’s corresponding 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:
All API calls to OpenWeather should be made to the https://api.openweathermap.org/data/3.0/ base domain.
OpenWeather API root/base URL:
An example endpoint is Get triggers, so here’s what the URL would look like for this endpoint:
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:
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:
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:
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:
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.
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:
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.
Crypto API Tutorials:
Need website help? Hire an SEO Consultant.