GARMINSTATS
TOOLKIT
Three Python scripts that run entirely in Google Colab — no installation, no server. Download your Garmin activities, upload them to Strava, and manage visibility in bulk.
.py files and upload them to your Colab session.Go to colab.research.google.com and create a new notebook, or open an existing one. Sign in with your Google account if prompted.
In the left sidebar, click the Files icon (📁), then the upload icon at the top. Upload garmin_download.py to your Colab session.
In a new Colab cell, run the install command. This only needs to be done once per session.
!pip install garminconnect garth --quiet
In another cell, use %run to execute the script. A styled login screen will appear in the cell output.
%run garmin_download.py
A login card will appear. Scroll down past it — you'll see text input fields for your email and password. Enter your Garmin Connect credentials. The password field is hidden as you type.
/content/garmin_tokens. On repeat runs, the login screen is skipped automatically — no password needed again.
Garmin may send a verification code to your email or phone. If prompted, check your inbox and enter the code in the field that appears below the ▼▼▼ markers.
The script fetches your full activity list then downloads FIT, GPX, TCX files and metadata JSON for each run. Progress is shown for every activity. When done, all files are saved to /content/GarminActivities/.
# ─── CELL 1: Install ─────────────────────────────────── # !pip install garminconnect garth --quiet # ─── CELL 2: Imports & Config ────────────────────────── import json, time, zipfile from datetime import datetime from getpass import getpass from pathlib import Path from IPython.display import display, HTML
Go to strava.com/settings/api and create a new app. Fill in:
App Name: anything (e.g. GarminImport)
Website: https://localhost
Authorization Callback Domain: localhost
Copy your Client ID and Client Secret — you'll need them next.
Open strava_upload.py and find these two lines near the top. Replace the placeholder values with your actual Client ID and Secret.
# ── Your Strava app credentials ────────────── CLIENT_ID = "YOUR_CLIENT_ID_HERE" CLIENT_SECRET = "YOUR_CLIENT_SECRET_HERE"
The upload script reads the download_index.json file created by the Garmin downloader. Make sure you've run garmin_download.py and the downloads are complete before proceeding.
Upload strava_upload.py to your Colab session and run it in a new cell.
%run strava_upload.py
On the first run, the script prints an authorization URL. Open it in your browser, click Authorize, then copy the full redirect URL from the address bar (it starts with http://localhost/...) and paste it back into the cell input.
localhost isn't a real server. You just need the URL from the address bar before closing the tab.
The script shows a menu with 5 options:
[1] Upload all remaining (skips already uploaded)
[2] Start from a specific number
[3] Upload specific activity numbers
[4] Show full list first, then choose
[5] Quit
[2] to resume from where you left off. Duplicates are detected and skipped automatically.
# ─── GARMIN ACTIVITIES → STRAVA AUTO-UPLOADER ─────────── # Run with: %run strava_upload.py import json, time from pathlib import Path from datetime import datetime from urllib.parse import urlencode, urlparse, parse_qs import requests
Open strava_visibility.py and update the credentials at the top of the script. Use the same Strava API app you created for the uploader.
CLIENT_ID = "YOUR_CLIENT_ID_HERE" CLIENT_SECRET = "YOUR_CLIENT_SECRET_HERE"
Upload strava_visibility.py to Colab and run it. No extra pip install needed — it only uses the built-in requests library.
%run strava_visibility.py
A styled authorization card appears with a button. Click Authorize on Strava, approve the app, then copy the full http://localhost/... URL from your browser and paste it into the input field below the card.
/content/strava_visibility_token.json. On future runs it refreshes automatically — no need to authorize again.
A numbered menu appears with 16 activity types. Pick the type you want to change, or choose [0] ALL to affect every activity on your account.
[1] Run [2] TrailRun [3] VirtualRun [4] Walk [5] Hike
[6] Ride [7] VirtualRide [8] Swim [9] Workout [10] WeightTraining
[11] Yoga [12] Rowing ... [0] ALL
Choose what visibility to set:
[1] 🌍 everyone — fully public
[2] 👥 followers_only — only your followers
[3] 🔒 only_me — private
A preview table shows the first 10 matching activities and their current visibility. Activities already at the target visibility are counted and skipped. Type YES to confirm, then watch the progress bar as each activity is updated.
# ─── STRAVA BULK VISIBILITY CHANGER ──────────────────── import requests, time, json from IPython.display import display, HTML CLIENT_ID = "YOUR_CLIENT_ID_HERE" CLIENT_SECRET = "YOUR_CLIENT_SECRET_HERE"
Already downloaded activities are preserved in /content/GarminActivities/. Just re-run garmin_download.py — it picks up from where it left off. For uploads, use option [2] to start from a specific activity number.
Check your spam folder. The code is sent to the email address associated with your Garmin account. You have about 5 minutes to enter it before it expires. If it expires, just re-run the script to get a new one.
Make sure you copied the full URL from your browser, including the ?state=&code=... part. The browser may truncate it if you single-click — triple-click the address bar to select all, then copy.
Strava allows 100 API requests per 15 minutes. All three scripts handle this automatically by pausing and resuming. If you're running multiple scripts simultaneously, pause one while the other is active.