Useful scripts for working with Strava data. A lot of functionality is based on my own personal use cases, but for the most part everything is written generically & with appropriate setup instructions to be adapted by others.
Do note, though, that a lot of code here is still a ๐ง work-in-progress ๐ง.
See SETUP.md for setup instructions.
Assuming all setup steps have been completed, the following scripts are available for use.
Note: Some scripts send push notifications via ntfy.sh when they complete (success or failure) with relevant stats & error details. See SETUP.md for configuration.
For the most common use case of syncing to both Google Sheets & Google Calendar:
./strava_syncThis runs both strava_to_pfitz_gsheet & strava_to_gcal in sequence.
Strava API results are cached locally for 1 hour to reduce API calls. The cache is automatically used when the requested date range falls within what's already cached.
To bypass the cache & fetch fresh data from Strava, use the --force-refresh/-f flag:
./strava_sync --force-refresh
python -m scripts.strava_to_gcal -f
python -m scripts.strava_to_pfitz_gsheet --force-refreshpython -m scripts.strava_to_pfitz_gsheet
Script to convert Strava activities into clickable links in Google Sheets tracking a Pfitzinger training plan. For an example of what this script does, see the rightmost column of izzy.gg/vancouver25.
python -m scripts.strava_to_gcal
Script to create Google Calendar events for Strava activities on specified calendar.
python -m scripts.{script_name}
Misc tasks that are personalized to my own use case. Not recommended for general use.
This repo uses pre-commit to automatically format & lint files before they are committed, & also as part of the required checks before a PR can be merged via pre-commit.ci. See .pre-commit-config.yaml for configuration details.
- Write script to automatically text me ~1 hr after running activity upload if I didn't specify gear (i.e. shoes).
- Figure out how to automatically trigger scripts when new activities are uploaded to Strava using webhooks.