Print

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

Click here to install the API Connector add-on from the Google Marketplace.

PART 1: GET YOUR DARK SKY API KEY

  1. If you haven't already, sign up for an account at https://darksky.net/dev
  2. Once you have an account, log in and navigate to the developer console.
  3. 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.
    darksky-img1

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.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created
    darksky-img2
  3. Leave the headers section blank as we don't need any headers for this request.
  4. Create a new tab and click 'Set' to use that tab as your data destination.
  5. Leave the headers section blank as we don't need any headers for this request.
  6. 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
  7. Name your request and click Run. A moment later you’ll see weather data populate the LAWeather tab in your Google Sheet:darksky-img3

PART 4: SHEETS + DARKSKY API NOTES AND EXPANSIONS

  1. 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).

  2. 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

Leave a Comment

Jump To