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
  • Source map error: Error: request failed with status 403 Resource URL: https://connect.garmin.com/web-react/static/js/backbone-lib.js?bust=4.40.1.0 Source Map URL: backbone-lib.js.map

  • Sorry, bug in the script -- my bad. I edited my previous comment with a new link.

    The script did run for me on Chrome/Firefox on Windows. Curious what browser/OS you're using.

  • Thanks for the update, I will try it on tommorrow. 

    I tried on both Chrome and Firefox on Windows.

  • Oh, it worked for me because I only tested with one (fake) scorecard haha. Anyway, it should be good to go now.

  • Hello, yes now it works and I got all my scorecards downloaded.

    Next would be to get help from you to make it in table format, can you help on that ?

    >>> As for getting this data into CSV, I can't easily help anyone with that, as the data has a complex structure (e.g. lists
    >>> inside of lists), so it's not trivial to "flatten it" so it can easily be displayed as table.

    Thanks in advance ;-) 

  • I edited my previous comment with a very basic jq script to convert your scorecards to CSV, after exporting them as JSON.

    You should be able to play around with the example to extract additional data.

  • I updated the golf export script to add a handy Download button. See link in original comment.

  • Hello, it is such a great what you provided - it works just fantastic and I even managed to modify "golf-export" script to add some more details to CSV ;-) 

    As I am not so fluent with json scripts I just would ask if you are able to extract hole pars to CSV ?

    "holePars": "434545434435454434

    Thanks a lot for all great you have done - I think many of us as golfers are really warmly welcoming this as now we can further analyse our golf statistics !

  • "holePars": "434545434435454434

    I updated the original comment with a link to the updated jq script.

    The new code is this:

                ($scorecard.holes | map(
                    .lastModifiedDt,
                    $course.holePars[.number-1:.number], // new code
                    .strokes,
                    .handicapScore,
                    .pinPositionLat,
                    .pinPositionLon
                ) | .[])

    In jq, filtering a string (holePars) with [x:y] gives you all the characters starting with index x, up to and not including index y. (The indexes start at 0.)

    In the golf export data, the scorecard hole number field is the hole # (starting at 1).

    So basically, the code is saying: "For hole X, give me the character from holePars at the same index"

  • I updated the export script and jq script to add a link to the scorecard in Garmin Connect, for convenience.

    I also added some sample json and a "spec" for how the script creates it.

    I probably won't be updating this anymore as obviously pastebin + garmin forums isn't an ideal way to host constantly changing code, but if anyone wants to host this on github and turn this into a real project, I've got no problem with that.