Stravacli
A CLI for updating Strava activities in bulk, uploading manual activities in bulk, and more.
Install / Use
/learn @vangent/StravacliREADME
stravacli
A command-line tool for working with Strava activities.
- Bulk upload activities, including manual activities, from a
.csvfile. - Bulk edit existing activities by downloading a
.csvfile and editing it in an editor or spreadsheet application, then uploading the changes.
Instructions
Build
- Install Go.
- Run
go install github.com/vangent/stravacli
Alternatively, you can clone this Github repository and build locally.
Create a Strava API application
To use the CLI, you need to create your own API application. This is kind of a pain, but it's a one-time thing, and it means that you're not giving any third parties access to your Strava data.
Follow the instructions at https://developers.strava.com/docs/getting-started/#b-how-to-create-an-account to create an API application.
- You can put anything you want for
Application Name,Category,Club, andWebsite; they don't matter for this application.http://unused.comwill work fine forWebsite. - Set the "Authorization Callback Domain" to "localhost".
- You can use any logo you'd like; here's a link to download a free one.
- Take note of the
Client IDandClient Secretfields, you'll need them in the next step.
Authenticate
Run
stravacli auth --client_id=<YOUR_CLIENT_ID> --client_secret=<YOUR_CLIENT_SECRET>
with the Client ID and Client Secret from your Strava API application. Your
browser will be redirected to Strava, where you'll need to log in (if you're not
already logged in) and authorize your application to connect to Strava. Note
that this is your own personal application, so you're not really giving anyone
besides yourself access. Once you've clicked Authorize, go back to your
terminal and stravacli will have printed out an access token for you to use
with other stravacli commands.
You may have to repeat this step periodically if your access token expires.
CSV Files
Most stravacli use CSV
data. There are lots of ways to edit CSV data, including:
- Using an editor like
vioremacs. - In a spreadsheet application like
Google SheetsorMicrosoft Excel.
Use Google to find out more. If you're using Google Sheets (it's free!),
here is help on how to import a
.csv into Google Sheets. To export back to .csv, choose File -> Download -> Comma-separated values.
Update Existing Activities
To bulk update existing Strava activities, first download them:
stravacli download --access_token=<YOUR_ACCESS_TOKEN> --out=orig.csv
This will download your existing activities into a CSV file file
called orig.csv. See stravacli download help for more detailed help, and
what the columns mean. You can now open or import the csv file in a
spreadsheet application of your choice.
Edit away; all of the columns are editable except for ID and Start. Sadly,
there are a lot of fields for activities that are not editable via the Strava
API.
When you are done editing, export the data as a .csv file again. Make sure not
to clobber the original .csv; the instructions below assume you name the file
updated.csv.
Finally, use stravacli to apply the changes. You can use --dryrun to see
what changes would be made without actually making them.
stravacli update --access_token=<YOUR_ACCESS_TOKEN> --orig=orig.csv --updated=updated.csv
See stravacli update help for more detailed help.
Upload Activities
See the next section for Manual Activities; this section is for activities with
an associated .gpx, tcx, or .fit file. To bulk upload activities, first
get the required header:
stravacli uploadheader > activities.csv
See stravacli uploadheader help for detailed descriptions of the data columns.
Add rows to the CSV file for the activities you'd like to create.
Finally, use stravacli to upload. You can use --dryrun to see what changes
would be made without actually making them.
stravacli upload --access_token=<YOUR_ACCESS_TOKEN> --in=activities.csv
See stravacli upload help for more detailed help.
Upload Manual Activities
To bulk upload manual activities, first get the required header:
stravacli uploadmanualheader > activities.csv
See stravacli uploadmanualheader help for detailed descriptions of the data
columns.
Add rows to the CSV file for the activities you'd like to create.
Note that Duration is in seconds, and Distance is in meters!
Finally, use stravacli to upload. You can use --dryrun to see what changes
would be made without actually making them.
stravacli uploadmanual --access_token=<YOUR_ACCESS_TOKEN> --in=activities.csv
See stravacli uploadmanual help for more detailed help.
Cleanup
If you are done using stravacli, you can revoke its API access
here.
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
