Connecting the Sportsdata API to Google Sheets

Sportsdata is the world’s leading supplier for sports-related live data. We can use the Sportsdata API to import data from Sportsdata into Google Sheets. In this tutorial, we’ll show you how to connect the Sportsdata REST API to Google Sheets in 5 steps:

  1. Install the Apipheny add-on
  2. Obtain an API Key
  3. Choose a Sportsdata API endpoint
  4. Enter the Sportsdata API request into the Apipheny add-on
  5. Run the Sportsdata API request in your Google Sheet

Step 1.) Install and open the Apipheny add-on in Google Sheets

To pull data from the Sportsdata API to Google Sheets, 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, save API requests, schedule API requests, and more. 

1. Install Apipheny by opening the following link on desktop and then clicking the Install button on the page: https://apipheny.io/install

2. After you’ve installed Apipheny, open a Google Sheet and then click on the Add-Ons or Extensions option in the top menu. In this menu, you should see Apipheny.

Click Apipheny > Import API to open the Apipheny sidebar in your Google Sheets.

open apipheny

Step 2.) Obtain an API Key

After logging into your Sportsdata account, go to https://sportsdata.io/developers/getting-started and choose the sport that you’d like to obtain the API key for:

Sportsdata developer page
Sportsdata developer page

In this example we chose NFL.

In the next popup, complete the first name, the last name, the company, the email address and check the terms and conditions checkbox, then click the Submit button: 

NFL API key request
NFL API key request

You will receive a confirmation message:

Confirmation message
Confirmation message

Check your email address for a Subscription Confirmation message. Click the LAUNCH DEVELOPER PORTAL button:

Subscription confirmation
Subscription confirmation

In your Developer Portal you will find your generated API key:

Generated API key
Generated API key

Copy and paste your API key in a safe location because you’ll need it later.

Step 3.) Choose a Sportsdata API endpoint

In this section, I’ll show you how to browse the Sportsdata API documentation to find an API endpoint that retrieves the specific information you need from your Sportsdata account. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.

First, open the Sportsdata API documentation page: https://sportsdata.io/developers/api-documentation

The default documentation that appears when you access the link is for NFL, but you can choose the sport you want.

The menu on the left contains general topics about the Sportsdata API and the API Documentation section with the sports as categories:

Sportsdata API documnetation page
Sportsdata API documentation page

If you click on a category (e.g NBA), a list with specific endpoints will be expanded in the main section of the page, along with a short description of that category:

NBA API documentation
NBA API documentation

An example endpoint is Are Games In Progress, which returns true if there are games in progress, or false otherwise. The URL for this endpoint is:

https://api.sportsdata.io/v3/nba/scores/json/AreAnyGamesInProgress

The endpoint’s documentation contains a short description of its purpose, its request URI, the API key you previously obtained if you chose this sport and a list of request parameters:

Are Games in Progress endpoint
Are Games in Progress endpoint

All API calls to Sportsdata should be made with the https://api.sportsdata.io/v3/ base domain.

Step 4.) Enter the Sportsdata API request into the Apipheny add-on

Okay, we’re in the home stretch. Now go back to your Google Sheet and make sure that the Apipheny add-on is open on 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) as required by your Sportsdata API endpoint. For this example, we are using the GET method.

API URL: In Step 3, we explained how you can find the Sportsdata API endpoint that you need. Now copy the complete API 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 are using the News by Team endpoint, which returns player news and notes. The corresponding URL for this endpoint is:

https://api.sportsdata.io/v3/nfl/scores/json/NewsByTeam/TEAM

Don’t forget to replace TEAM with a correct team abbreviation.

In the Headers of the Apipheny add-on section, add one row with the following key and value:

Header
Key:
Ocp-Apim-Subscription-Key
Value:
API_KEY

You have to replace the API_KEY value with the value you previously obtained in Step 2.

Sportsdata API request entered into Apipheny
Sportsdata API request entered into Apipheny

Step 5.) Run the Sportsdata API Request in your Google Sheet

The last step is to click the Run button at the bottom of the Apipheny add-on and then your Sportsdata data will be imported into your Google Sheet:

 Sportsdata data imported into Google Sheets
Sportsdata data imported into Google Sheets

After making a successful request to the Sportsdata API, try querying a different Sportsdata API endpoint, or try using one of the more advanced features in the Apipheny add-on:


More API Tutorials


More API Tutorials

Related Posts