Strava is a social network for athletes. We can use the Strava API to import data from Strava into Google Sheets. In this tutorial, we’ll show you how to connect the Strava API to Google Sheets in 5 steps:
To pull data from the Strava 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 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.
Go to https://www.strava.com/settings/api and create an app, so you can obtain credentials. After completing the required fields, click the Create button:
Choose an icon for your app by clicking the + button:
Click the Save button to save it:
Your credentials, including the access token, will then be displayed on the screen:
This token expires after 6 hours. The refresh_token may be used to get a new access token when that time period is up.
To refresh your toke, open up a command prompt window for Windows OS or a terminal for Mac OS and compose the following curl command:
curl -X POST
https://www.strava.com/api/v3/oauth/token-d client_id=ReplaceWithClientID -d client_secret=ReplaceWithClientSecret -d grant_type=refresh_token -d refresh_token=ReplaceWithRefreshToken
Note: For Mac OS you may need to use single quotes ( ‘ ).
Request Parameters
Note: If the token/key that you generate has an expiration time, you will need to complete this same process again to get a new token when the old one expires.
In this section, we’ll show you how to browse the Strava API documentation to find an endpoint that retrieves the information you need from your 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 Strava API documentation page: https://developers.strava.com/docs/reference/
The menu on the left contains a list of the Strava API endpoints:
An example endpoint is Get Activity, which returns an activity owned by the authenticated athlete:
https://www.strava.com/api/v3/activities/{id}?include_all_efforts=TRUEorFALSE
If you use this URL, don’t forget to replace {id} with a real value. Also, choose only one value for the include_all_efforts parameter, TRUE or FALSE.
The endpoint’s documentation contains a short description of the endpoint’s purpose, its HTTP method (GET), the URI, a list of accepted parameters, the curl request and an example response:
All API calls for Strava should be made to the https://www.strava.com/api/v3/ base domain.
Note: Check their documentation to confirm the latest version and update the version number in the URL if necessary.
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) 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 Strava REST API endpoint that you need. Now copy and paste your complete Strava API URL into the Apipheny add-on, where it says API URL Path, followed by any parameters required for your query (if applicable).
For this example, we are using the Get Authenticated Athlete endpoint, which returns the currently authenticated athlete. The whole URL for this endpoint is:
https://www.strava.com/api/v3/athlete
Headers: In the Headers section of Apipheny, add one row with the following key and value:
Key: Authorization Value: Bearer your_auth_token
your_ auth_token is the value of the token generated previously, in Step 2. There should be a space between “Bearer” and your token in the header value.
Finally, the last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Strava API data to be imported into your Google Sheet. Here’s what our request looked like when completed:
That’s it! You’ve successfully connected your Strava account to Google Sheets using the Strava API, Google Sheets API, and the Apipheny add-on.
After making a successful request to the Strava API, try querying a different Strava API endpoint, or try using one of the more advanced features in the Apipheny add-on.
Schedule requests for automatic updates
Reference cell values in requests
Stack multiple URLs in a single request
Crypto API Tutorials: