In this tutorial, you will learn how to connect the OpenWeather REST API to Google Sheets in 5 steps:
To pull data from the OpenWeather API to Google Sheets easily and without writing any code, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs (including the OpenWeather API), save API requests, schedule API requests, and more. Click here if you want to learn more about Apipheny.
1. Install Apipheny by clicking the Install button on this page.
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:
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:
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:
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.
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:
Meelad Mashaw