To pull data from the OpenWeather API to Google Sheets, first install and open the Apipheny Google Sheets add-on.
Apipheny is an API integrator for Google Sheets. You can use it to make unlimited API requests and connect to unlimited API data sources. Plus you can save your API requests and more. Click here for more information about Apipheny. There’s a 30-day free trial included, then it’s $19-$29/month.
1. Install Apipheny by opening the following link in on desktop and then clicking the Install button on the next page: https://gsuite.google.com/marketplace/app/apipheny/966163326746
2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons option in the top menu. In the add-ons menu, you should see Apipheny.
Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.
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:
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-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:
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 (JSON / CSV), 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.
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.
If you want to learn how to connect more APIs to Google Sheets, check out these related articles: