This repo was inspired by the Export Golf Scorecards thread on the Garmin forums and the scripts by WillNorthYork for downloading and converting your Garmin golf data to JSON/CSV. Since Garmin doesn't offer APIs for accessing one's own golf data, this really is the only approach for getting your data out of Garmin.
I've modified the original code to download club data and shot-by-shot data for those users of Garmin's CT10 shot trackers.
I'm now in the process of upgrading this to Python, Pandas and Streamlit. See the JQ section below if you want the original JQ + Google Sheets version
Regardless of whether you use the older JQ version or the newer Pandas/Python version, you need to get data from Garmin and there is only one way to do that.
Directions taken, more or less, from the thread linked above and modified for the script being in this repo.
-
Download or otherwise copy/checkout the script in
src/garmin-download.js
-
Sign into Garmin Connect
-
While still on the Garmin Connect tab, open debug console: F12 / CTRL-SHIFT-I (Window) / CMD-OPTION-I (Mac)
-
Paste script into debug console. A dialog will open in the Garmin Connect tab.
-
To run it a 2nd time (for the same tab and session), type the following text in the console:
gcExportGolfScores()
- Download or otherwise copy/checkout the script in
src/garmin-download.js
- Open this page: https://caiorss.github.io/bookmarklet-maker/
- Set title to "GC export golf scores"
- Paste script into "Code" box
- Click "generate bookmarklet"
- Drag blue bookmarklet to bookmarks bar. If the bookmarks bar isn't visible, press CTRL-SHIFT-B (Windows) / CMD-SHIFT-B (Mac).
If you don't have a bookmark bar or you're on mobile, select and copy the contents of Output box, bookmark any site at all, edit the bookmark, then paste what you just copied into the Address/Location/URL box. (In Firefox you can also right-click and select "Bookmark this link")
-
Sign into Garmin Connect
-
Click on "GC export golf scores" bookmark. A dialog will open in the current tab.
For a variety of reasons, I've decided to rewrite this. While JQ is awesome for a lot of things, it starts to get clunky in spots and I've never loved the whole Google Sheets piece, so when a friend intro'd me to Streamlit, it felt like this was the perfect app to try it out on, not too mention Pandas is frickin' awesome.
- Create a Virtual Environment (e.g. pyenv)
pip install -r requirements.txt
NOTE: If you just want the JSON, you can skip this step
- Install jq for your platform: https://stedolan.github.io/jq/download/
- Clone or otherwise download this repository. In the
src
directory are severaljq
scripts for converting various aspects of the JSON to CSV. - Create a
data
directory:mkdir data
This script will reshape some of your golf export data into tabular CSV data. (Only certain fields for each scorecard will be saved, like the scores for each hole.)
NOTE: This script is very basic. You may want to edit it to save more details from the export.
-
Use the export script to download your golf scorecard data. It will be saved as golf-export.json. Save this file to the
data
directory you created above. -
Open Windows command prompt or MacOS/Linux terminal
-
Run the jq script on the exported data:
To run one conversion script:
jq -r -f src/scorecard-csv.jq data/golf-export.json > data/golf.csv
To run all conversion scripts (Linux/Mac Terminal only) and output the results to the
data
directory:./convert-all-csv.sh /path/to/json/file /path/to/store/results
Converted files will be named the same as the JSON file with
.csv
tacked on the end.If you are going to import this data into Google Sheets, per below, you will need to either upload your CSV files to Google Drive or run the script to output the data to a Google Drive folder, as in:
./convert-all-csv.sh data/golf-export.json "/Users/MyUser/Google Drive/sports/golf"
-
Open golf.csv with Excel or Numbers or import into Google Sheets.
Windows:
start data/golf.csv
MacOS:
open data/golf.csv
Under the src/google_sheets
directory are scripts and HTML files that can be used via the Google Sheets Apps Script function to automatically import your CSV data as generated above
from a selected Google Drive folder and import it into your current Spreadsheet, assuming your spreadsheet is set up a specific way.
Note: this is not a Google Apps Script tutorial. See https://developers.google.com/apps-script?hl=en for details on getting started and understanding Google Apps Script.
-
Create a new Google Spreadsheet. (If you are using Google Chroome and are logged in as a Google user, you can simply type
sheets.new
in the Chrom URL window) -
Create 6 sheets by hitting the "little plus button" in the lower right corner of your Spreadsheet or choosing
Insert->Sheet
six (6) times -
Name the sheets: Scorecards, Hole by Hole, Raw Shot Data Row Order, Raw Shot Data Column Order, Gear, Last 10 Rounds Stats, Last 10 Rounds Drive, Last 10 Rounds Approach, Last 10 Rounds Chip, Last 10 Rounds Putt
As an aside, I also create an `Analysis` sheet where I plug in all my analysis formulas and dashboards
-
Choose
Extensions->Apps Script
from the Spreadsheet menu. This should pop open a new window calledApps Script
titledUntitled Project
. Name your project. -
Under the
Editor
part of the Apps Script project do the following:- Copy and paste the
src/google_sheets/Code.gs
file into theCode.gs
editor window. - Create a new HTML file in the project by selecting the
+
button next to theFiles
menu in theEditor
part of the project. ChooseHTML
from the popup. Call itPicker
- You should now see two files under your project:
Code.gs
andPicker.html
- You should now see two files under your project:
- Replace the generated HTML in
Picker.html
by copying and pasting the HTML insrc/google_sheets/Picker.html
. - Make sure both files are saved.
- Copy and paste the
-
Reload your spreadsheet. You should now see a new menu titled
Import Garmin Data
-
Select the menu item and follow the prompts. Once completed, you should see your data in the 6 spreadsheets.