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

Is there a way to delete all Garmin Connect data before a certain date?

So ... back in 2019 I bought my first Garmin watch and created my account. I was coming from another fitness watch vendor and I exported all my activities and tried to import them in Garmin Connect. Something went wrong, I was getting errors, but at the end I ended up with data imported wrongly. So, for the period of time between 2015-2019 I have daily step counts in the millions.

Back in 2019 Garmin support told me there was no way to remove that data, except to manually delete every day from the web UI. There are 988 days I want to delete, so that is not practical.

Is there any way, today, in 2023, to do a cleanup of old data before a specific date? I would like to delete all my data before April 2019.

  • I ended up writing some JavaScript code and run it in Chrome's inspector. 

    I am not sure if I am allowed to post it here, so if someone can confirm that this is OK I will put my 10 or so lines of code here.

  • There are already multiple similar threads on the forum, and the moderators did not pull them down, so I guess it is OK. Best post your code to one of the already existing threads, to keep the info together. For example the following thread may be suitable, although the demanded condition for deleting, is by user, not by date:

    https://forums.garmin.com/apps-software/mobile-apps-web/f/garmin-connect-web/165851/can-i-delete-just-the-activities-from-a-single-garmin-device-from-my-garmin-connect-account 

  • Yeah, that's different. That user wants to delete activities. I wanted to delete daily summaries / steps counts.

  • So, here is the way I did it.

    1. Go to a daily summary from the past you want to delete.
    2. Open your browser's developer tools (in Chrome, right click -> Inspect)
    3. Select the network tab in developer tools and clean it
    4. No, click on cogwheel in Garmin Connect Web for the daily summary and delete it
    5. Look in the developer console for the first request (you should see the date, for example 2014-02-01). Right click on the request, select Copy -> Copy as fetch
    6. Take the code below and set your start and end dates for witch you want your daily summaries to be deleted
    7. Update the fetch URL as in the example code by removing the date and adding the variable name
    8. Copy / paste the code to the browser's JavaScript console and run it

    const start = new Date("11/23/2019"); // update this with the first date to delete
    const end = new Date("04/20/2020"); // update this with the last date to delete
    let loop = new Date(start);
    while (loop <= end) {
    	let dateString = loop.getFullYear() + "-" + String((loop.getMonth() + 1)).padStart(2, '0') + "-" + String(loop.getDate()).padStart(2, '0');
    	console.log("Deleting data for: " + dateString);
    
    	fetch("https://connect.garmin.com/wellness-service/wellness/dailySummary/" + dateString, {
    		// removed code for security reasons
    		// replace this fetch (...) with ALL the stuff taken from the browsers developer tools with copy -> copy as getch
    		// Don't forget to change the URL as in the example above with `+ dateString`
    	});
    
    	await new Promise(r => setTimeout(r, 1000));
    
    	let newDate = loop.setDate(loop.getDate() + 1); // DON'T REMOVE THIS. This introduces a one second wait between requests to avoid spamming Garmin servers. We don't to do any harm.
    	loop = new Date(newDate);
    }
    

    NOTE: Do not refresh the webpage while this code runs!