Search API Connector Documentation

Print

Import Strava Data to Google Sheets

premium

In this guide, we’ll walk through how to pull Strava data data directly into Google Sheets, using the API Connector add-on for Sheets. Strava is, of course, a well-known fitness tracker website and app.

For a real-life example, please also check out this awesome video made by an API Connector user!

Contents

Before You Begin

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

Part 1: Connect to the Strava API

If you haven’t connected API Connector to Strava before, you’ll first need to initiate the connection as follows:

  1. Open up Google Sheets and click Extensions > API Connector > Manage Connections.
  2. In the list of available connections, find Strava and click Connect.
    strava-img1
  3. You will be directed to strava.com and asked to sign in, if you haven’t already. You’ll also be asked to authorize the connection.
    strava-img7
  4. You’ll then be returned to your Google Sheet, and can verify that your Strava connection is active in the Connections screen.

Part 2: Create Your Strava API Request URL

For our first request, we’ll get some basic information about your Strava account.

  • API root: https://www.strava.com/api
  • Endpoint: /v3/athlete


Putting it all together, we get the full API Request URL.

https://www.strava.com/api/v3/athlete

Part 3: Pull Strava API Data into Sheets

Now let’s grab some data!

  1. In API Connector, click Create, and paste in the Request URL we created above.
    strava-url
  2. Under OAuth, choose “Strava” from the dropdown menu. You should see a “Connected” badge.
    strava-connected
  3. We don’t need any headers so just skip that section.
  4. Create a new tab and click Set current to use that tab as your data destination.
  5. Name your request and click Run. A moment later you’ll see some information about yourself populate your sheet.
    strava-response

Part 4: More Example API URLs

To get more information about your Strava activities, try the following URLs (one at a time).

  • Get your own starred segments
    https://www.strava.com/api/v3/segments/starred
  • Get a public list of running races
    https://www.strava.com/api/v3/running_races
  • Get your own activities
    https://www.strava.com/api/v3/athlete/activities
    strava-img6

Part 5: Handle Pagination

Note Strava’s limits on the number of records returned on a response. By default, only 30 records will be returned unless you use pagination handling as described in their documentation.
strava-img8

This means that to get 200 records, you’d use the ‘per_page’ parameter, and to return more than 200 you’d then make subsequent requests using the ‘page’ parameter.

With API Connector you can loop through these automatically with pagination handling, like this:

  • API URLenter your request URL, including ?per_page=200
  • Pagination typepage parameter
  • Page parameterpage
  • Number of pagesenter the number of pages you’d like to fetch
    pagination-page-parameter

Part 6: API Documentation

To see more API endpoints and example responses, I suggest checking out out the Strava API playground located at https://developers.strava.com/playground/.

Previous Import Spotify Data to Google Sheets
Next Import Stripe Data to Google Sheets

24 thoughts on “Import Strava Data to Google Sheets”

  1. Hi, I tried using this with the endpoint https://www.strava.com/api/v3/athlete/activities but it only returned 30 activities. The cutoff point seemed random, it only went back to May 2020.

    Is this a problem with Strava’s OAuth? Should this API connection work in 2021 still?

    Thanks

    Reply
    • Good question, I just checked Strava’s API docs and by default they only send 30 records at a time. To get more, you can add ?per_page=200 to the end of your URL. If you have more than 200 records, you would paginate through using “page parameter” pagination. I’ll update the article to include this info.

      Reply
  2. Hi Anna,
    Do you think it’s possible to get activity date from strava. I don’t see it in Strava API documentation.

    Or can we get data using API Connector, by filtering “Today Activities” Only (based on date range) ?

    Reply
    • Hey Rudy, when you run the https://www.strava.com/api/v3/athlete/activities request, it returns a “start_date” field, is that what you’re looking for?

      Reply
      • Gotcha. Based on what I see in their API docs, they only return the following for the /clubs/{id}/activities endpoint:
        [
        {
        "resource_state": 2,
        "athlete": {
        "resource_state": 2,
        "firstname": "Peter",
        "lastname": "S."
        },
        "name": "World Championship",
        "distance": 2641.7,
        "moving_time": 577,
        "elapsed_time": 635,
        "total_elevation_gain": 8.8,
        "type": "Ride",
        "workout_type": null
        }
        ]

        There’s no date in there so it doesn’t look like this is available. I checked and found quite a few people complaining about this (e.g. here, here, here). Sorry about that.

    • That is, I can run: https://www.strava.com/api/v3/athlete/activities/{id]/streams, but I can’t make it return anytthing but distance.

      Reply
      • I’m trying to make a heart rate based measure of training load. Currently I use the open software Golden Cheetah to do this and copy-paste the values over to Google Sheets.

      • I see. Their docs are pretty unclear on this point, and I don’t have my own data to test with, but could you please try this?
        https://www.strava.com/api/v3/activities/{id}/streams?keys=distance,latlng,velocity_smooth,altitude,heartrate&key_by_type=true

        Let me know if that gets you back what you’re looking for.

  3. is there a means to use values from the sheet as parameters on the api. For example, the strava gear api requires the gearid which can be gotten from activities. I would like to pass the gearid to the api in a loop to get all the gear records.

    Reply
  4. Hello! Thank you for the article! Could you please advise how or where can I get the Club’s id? I would like to export recent activities of club members but for API
    /clubs/{id}/activities

    Thanks in advance.

    Reply
  5. Hi

    I love API connector and have imported all my Strava activities into Google Sheets.

    While analyzing them I initially couldn’t find most of the activities I did abroad (outside the Netherlands for me). Looking closer they are there but almost all of them are listed with location_country=Netherlands, although in some cases the time zone indicates Switzerland or France. In the Strava web interface these activities are located in the correct countries.

    When I search the Strava API documentation (https://developers.strava.com/docs/reference/) location_country is not really explained.

    I would like to be able to filter for foreign activities. How can I get the correct data?

    Cheers,
    Marnix

    Reply
    • I’m not really familiar with this but after checking online, this seems to be a bug in the Strava API.
      I see a few people mentioning it, e.g. here and here
      So unfortunately it looks like you will have to use the web interface for this 🙁

      Reply
      • As far as I know, you have the following options:
        1) https://www.strava.com/api/v3/athletes/{id}/stats. This will show you your YTD totals, but only for activities set to Everyone.
        2) https://www.strava.com/api/v3/athlete/activities. This will show all your data, split out for each activity date, so you’ll need to aggregate it yourself.
        You can also check in with Scott over at YouTube, he’s way more familiar with Strava’s API than I am and might have some ideas! https://www.youtube.com/watch?v=c4kKao0hGO4

Leave a Comment

Table of Contents