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 pulse ox data timeline

Is there anyway to export the detailed information that was inside of the sleep data? I would like to be able to export that information so that I can keep record. 

  • Okay here you go. Instructions should work in Chrome/Firefox/Safari on PC, Mac or Linux. (Even mobile, but the UX would be bad)

    Setup

    1) Go here (https://pastebin.com/P0E1y8VJ) to get the script: copy RAW Paste Data
    (Click on RAW Paste Data contents, press CMD/CTRL-A, CMD/CTRL-C)

    2) Go here (https://caiorss.github.io/bookmarklet-maker/) to make a bookmarklet for easy script access.

    2a) Enter Title: "GC sleep data" (or whatever)

    2b) Paste text from 1) into Code field

    2c) Click "Generate Bookmarklet"

    2d) Drag the bookmarklet (blue rectangle/pill) to your bookmarks bar. (If bookmark bar is not visible, press CMD/CTRL-SHIFT-B).

    (If you are on mobile or you don't have a bookmarks bar, bookmark any site at all, copy the contents of the Output field, edit the bookmark and paste what you just copied into Address/URL/location. Or if your browser supports it, right-click on the bookmark and select Bookmark this Link.)

    Usage

    1) Log into GC

    2) Click on "GC sleep data" bookmark

    3) You will be prompted for the date of the sleep data you want to see. (This defaults to today. If you navigate to the GC sleep page for a given date first, then this will default to that date.)

    4) Your sleep data be displayed in a modal, which also has a button to copy the data to the clipboard.

    EDIT: The script has been updated so entering your username is no longer necessary. Thanks !

  • I feel like this is the kind of thing that would work a lot better as a python script for bulk downloading, but I'm not sure if there would be any interest.

  • Thanks, works a treat! (The pastebin link has the extra ')' which needs to be stripped - for those who also attempt).

    In Chrome the pop-up doesn't seem to allow select/copy and it truncates after only a few lines. To get this, as you said, use the Dev Tools Console, though it will need to be expanded before copying.  

    Eventually I'd like to format the spO2 data in a way that can be mapped up against my nightly CPAP data, that's the push behind all this (and a large reason I went shopping for this Garmin in the first place). 

    Out of curiousity, how would I have been able to make this work once? Seems strange. 

  • Thanks, fixed the link. I found that it works once as well. Probably if you visit the sleep page it makes an initial successful request, and if you manually make an additional request to the API soon after, the "authorization" from the initial request is cached for some period of time or something.

    Ofc it's a little silly since all you have to do is add that one header. I guess it prevents casual attempts to replay the request.

  • If you want to avoid using of any scripts, or entering your password anywhere, then you can also simply use DevTools in your browser:

    1. Open DevTools (Ctrl+Shift+i or F12), referably on another monitor or seaprate window, because if kept docked, the DevTools panel is a bit too small
    2. Activate the Network tab in DevTools, and enable the filter XHR
    3. On the main browser window go to the Sleep page of the day that interests you
    4. Click the line starting with your User ID (there may be two of them, so try both, and in the Preview you'll get the data (in the Response tab you can copy it and paste it into the JSON/CSV converter mentioned earlier in this thread).

  • Good point, but you don't have to enter your password for the script solution (as it only works when you're authorized anyway), you only have to enter your username (unless I can figure out a way to retrieve that programmatically).

    The js script I posted essentially automates what you just posted, and the code is transparent and simple enough that anyone can audit that it doesn't do anything malicious.

    (Besides, due to cross-site scripting security policies, this script has a limited ability to do bad things (like exfiltrate your private data), especially since it's not asking for your password.)

    I personally prefer bookmarklets (even though they're a pain to install), because they're a 1-click solution most of the time, without all the overhead and insecurity of extensions.

  • The script has been updated so entering your username is no longer necessary. Thanks !

  • I struggled to copy/save the raw data from the 'Preview', I did not realize it could be found in the 'Response' tab. Thanks!

  • I struggled to copy/save the raw data from the 'Preview', I did not realize it could be found in the 'Response' tab. Thanks!

    I've updated the script to display a modal with the full response, and a button to copy the response to the clipboard. (See pastebin link in previous post)

    I also updated it so the default date is today, not yesterday.

  • Hi, I'm not as expert as this conversation is, but I've managed to copy the sleep data to a clipboard by following your instructions.  Can you please explain how I get the data into a better/readable format? Many thanks!