API Connector Documentation
Import Dark Sky Data to Google Sheets
Update: Dark Sky has been acquired by Apple, and their API has been shut down. This article is provided only for reference and will be deleted at some point. I suggest checking out the OpenWeatherMap API or Weatherstack API instead.
In this guide, we’ll walk through how to pull data from the Dark Sky API directly into Google Sheets, using the API Connector add-on for Sheets. We'll first get an API key from Dark Sky, and then set up a request to pull in weather forecast details from Dark Sky to your spreadsheet.
- Before You Begin
- Part 1: Get your Dark Sky API Key
- Part 2: Create your API Request URL
- Part 3: Pull API Data to Sheets
- Part 4: Notes and Expansions
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: GET YOUR DARK SKY API KEY
- If you haven't already, sign up for an account at https://darksky.net/dev
- Once you have an account, log in and navigate to the developer console.
- There should be a default API key already created for you. Keep it handy as we'll need it shortly. That's it! You now have access to weather data from the Dark Sky API.
PART 2: CREATE YOUR DARK SKY API REQUEST URL
We’ll first follow the Dark Sky API documentation to access a weather forecast for Los Angeles, California.
- API root: https://api.darksky.net
- Endpoint: /forecast/YOUR_API_KEY/{latitude,longitude}
Endpoint Example: /forecast/caf42bd....../37.8267,-122.423
Putting it all together, we get the full API Request URL:
https://api.darksky.net/forecast/caf42bd....../37.8267,-122.423
(Of course, you should substitute in your own API key and location of interest.).
PART 3: PULL DARK SKY API DATA INTO SHEETS
We can now enter all our values into API Connector and start importing Dark Sky weather data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
- In the Create Request interface, enter the Request URL we just created
- Leave the headers section blank as we don't need any headers for this request.
- Create a new tab and click 'Set' to use that tab as your data destination.
- Leave the headers section blank as we don't need any headers for this request.
- Under the Output Options choose the 'Compact' report style. This isn't necessary but makes this report easier to view. More on report styles here: Report Styles
- Name your request and click Run. A moment later you’ll see weather data populate the LAWeather tab in your Google Sheet:
PART 4: SHEETS + DARKSKY API NOTES AND EXPANSIONS
- By default, the Dark Sky API will return a lot of data. Reduce the quantity of this data using their "exclude" parameter. For example, to return a weather forecast without minute by minute data, create a request URL like this:
https://api.darksky.net/forecast/caf42bd..../37.8267,-122.4233?exclude=minutely
You can set exclusions for currently,minutely, hourly, daily, alerts, and flags (multiple options can be excluded in a comma-separated list).
- Set "Time Machine Requests" to return the historical or forecasted weather conditions for a particular date. For example:
https://api.darksky.net/forecast/caf42bd..../42.3601,-71.0589,255657600?exclude=currently,flags