This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Export Golf Scorecards

Is there a way to export the golf scorecards from Garmin Connect to an excel compatible file? I've kept a spreadsheet of my golf scorecards for many years and just started using a Garmin D2 Bravo Ti when I play. I'd like to keep up the spreadsheet but it would be a shame if I have to manually input each card still.
Thanks,
Bruce
  • I have written code for Microsoft Access to import the xml scorecard files that are stored on the Approach G3 GPS into an Access database.
  • Hello. I've run into thia issues as I am trying to pull data and track progress. Would you mind sharing yoir code ? I would immensely appreciate that. 

    Thank you

  • If  does not answer, I think I am able to help too. Unfortunately for you, I play no golf, so have no scorecards in my GC account, and cannot test it, but I believe the data should be accessible through the following address, in JSON format (it does not look well readable, but it is easy to convert to whatever format you need):

    https://connect.garmin.com/modern/proxy/gcs-golfcommunity/api/v2/scorecard/summary?per-page=10000

    (you have to select the checkbox "stay connected" when logging into your GC account, otherwise you could get an error message about denied access).

    If a page full of data appears, you can then convert it to CSV or Excel by copying and pasting to this page:

    http://convertcsv.com/json-to-csv.htm

  • Hello trux,

    I would be very much thankful if you can help myself to get all my golf statistics / score cards from Garmin Golf App.

  • is there a reference page for other api or is this the only one... I want to extract each shot registred on the scorecard (club, lenght etc... possible or just a dream or manual work :)

  • Nice!

    Do you have similar URL links for the details and the club statistics for example? Or a link to where i can find the documentation myself?

  • is there anyone having solution to export golf scorecard statistics to excel ?

  • EDIT:

    Latest files:

    Latest json export JS script (2021-03-20):  https://pastebin.com/K7QEHYAD

    Latest json-to-csv conversion jq script (2021-03-20): https://pastebin.com/sw3Eh3w8

    Latest changes:
    - Add scorecardURL field to each scorecard
    - Add download button

    JSON Structure

    The JSON export contains Garmin's golf summary list data, and all of the detailed scorecard data, as follows:

    Sample JSON data

    (Personal data like IDs, lat/lon, and course info has been scrubbed)

    https://pastebin.com/n0zr1ma0


    Do you have similar URL links for the details and the club statistics for example? Or a link to where i can find the documentation myself?

    I cooked up a script to export not only the golf scorecard summary list, but also the details for every scorecard, as a single JSON file (which is structured text with "records" and "lists").

    As for getting this data into CSV, I've provided a small jq script and instructions to use it below; the jq script will convert *some* of the data to CSV.

    At the very least this gives you a way to preserve your data, and you'll be able to do anything you want with it.

    For any non-golf-playing devs wanting to test this kind of thing, you can use the Garmin Golf mobile app to create golf scorecards.

    1. Export Golf Scorecards as JSON

    Usage without Installation

    1) Get script from here:

    https://pastebin.com/K7QEHYAD

    Copy the script contents to your clipboard: Scroll to bottom of page, click on "RAW Paste Data" box, then:
    - (Windows) CTRL-A, CTRL-C
    - (Mac) CMD-A, CMD-C

    2) Sign into Garmin Connect

    3) While still on the Garmin Connect tab, open debug console: F12 / CTRL-SHIFT-I (Window) / CMD-OPTION-I (Mac)

    3) Paste script into debug console. A dialog will open in the Garmin Connect tab.

    4) To run it a 2nd time (for the same tab and session), type the following text in the console:

    gcExportGolfScores()


    Installation

    1) Get script from here:

    https://pastebin.com/K7QEHYAD

    Copy the script contents to your clipboard: Scroll to bottom of page, click on "RAW Paste Data" box, then:
    - (Windows) CTRL-A, CTRL-C
    - (Mac) CMD-A, CMD-C

    2) Open this page: https://caiorss.github.io/bookmarklet-maker/

    2a) Set title to "GC export golf scores"

    2b) Paste script into "Code" box

    2c) Click "generate bookmarklet"

    2d) 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")

    Usage after Installation

    1) Sign into Garmin Connect

    2) Click on "GC export golf scores" bookmark. A dialog will open in the current tab.


    2. Convert JSON to CSV

    Prep

    1) Install jq for your platform: https://stedolan.github.io/jq/download/

    2) Download the following jq script (gc-golf-export.jq.txt) to your Downloads folder.

    https://pastebin.com/sw3Eh3w8

    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.

    If you are on Mac:

    Install homebrew (https://docs.brew.sh/Installation) and run the following commands in Terminal:

    cd ~/Downloads

    brew install dos2unix

    dos2unix gc-golf-export.jq.txt

    If you are on Linux:

    cd ~/Downloads

    dos2unix gc-golf-export.jq.txt

    Conversion

    1) Use the export script to download your golf scorecard data. It will be saved as golf-export.txt. Save this file to your Downloads folder.

    2) Open Windows command prompt or MacOS/Linux terminal

    3) Change to docs folder:

    Windows:

    cd %USERPROFILE%\Downloads

    MacOS:

    cd ~/Downloads

    5) Run the jq script on the exported data:

     jq -r -f gc-golf-export.jq.txt golf-export.txt > golf.csv

    6) Open golf.csv with Excel or Numbers.

    Windows:

    start golf.csv

    MacOS:

    open golf.csv

  • wow, this is so cool, thanks for sharing.

    Unfortunately maybe my handicap in scripts but I got following error when trying Usage without Installation ?

    VM1648:60 Uncaught ReferenceError: startTime is not defined
    at <anonymous>:60:98
    at Array.sort (<anonymous>)
    at onReceive (<anonymous>:60:39)
    at Object.success (<anonymous>:41:29)
    at o (backbone-lib.js?bust=4.40.1.0:1)
    at Object.fireWith [as resolveWith] (backbone-lib.js?bust=4.40.1.0:1)
    at S (backbone-lib.js?bust=4.40.1.0:1)
    at XMLHttpRequest.t (backbone-lib.js?bust=4.40.1.0:1)