GitHub - datachasercom/garmin-analytics: A Node.js script that connects to Garmin Connect and generates analytics reports showing your activity statistics aggregated by year and activity type.

2 min read Original article ↗

Garmin Analytics

A Node.js script that connects to Garmin Connect and generates analytics reports showing your activity statistics aggregated by year and activity type.

Description

This tool fetches your Garmin Connect activity data and displays two comprehensive tables:

  1. Activity Count Table: Shows the total number of activities by activity type and year
  2. Calories Burned Table: Shows the total calories burned by activity type and year

The script aggregates data from up to 1000 activities (configurable) and presents it in an easy-to-read tabular format in your terminal.

Installation

  1. Clone or download this repository
  2. Install Node.js (version 12 or higher recommended)
  3. Install dependencies:

Usage

Simply run the script and it will prompt you for your Garmin Connect credentials:

The script will ask for:

  1. Username: Your Garmin Connect email address
  2. Password: Your Garmin Connect password (input will be hidden with asterisks)

After entering your credentials, the script will log in and fetch your activity data.

Example Output

When you run the script, you'll see output similar to the following:

Garmin Connect Username: your_email@example.com
Garmin Connect Password: ********
Logging in to Garmin Connect...
Login successful.
Fetching activities...

Activities (rows = activity types, columns = years):

┌──────────────────┬──────┬──────┬──────┐
│ Activity Type    │ 2021 │ 2022 │ 2023 │
├──────────────────┼──────┼──────┼──────┤
│ cycling          │   45 │   52 │   48 │
│ running          │   78 │   85 │   92 │
│ swimming         │   12 │   15 │   18 │
│ walking          │   23 │   28 │   31 │
└──────────────────┴──────┴──────┴──────┘

Burned Calories by Year and Activity Type:

┌──────────────────┬────────┬────────┬────────┐
│ Activity Type    │   2021 │   2022 │   2023 │
├──────────────────┼────────┼────────┼────────┤
│ cycling          │ 125430 │ 145680 │ 132450 │
│ running          │ 234560 │ 256780 │ 278920 │
│ swimming         │  45670 │  52340 │  61230 │
│ walking          │  34560 │  41230 │  47890 │
└──────────────────┴────────┴────────┴────────┘

Notes

  • The script fetches up to 1000 activities by default. If you have more activities, you'll need to modify the getActivities() call in index.js to paginate through your data.
  • Activity types are determined by Garmin Connect's activity type classification.
  • Calories data depends on what's available in your activity records.

Dependencies

  • garmin-connect: Garmin Connect API client
  • cli-table3: Terminal table formatting