Last active
July 29, 2022 08:57
-
-
Save jpomfret/aa6451f80d0ea5534df349221e8c3c1d to your computer and use it in GitHub Desktop.
Reformat the weight.csv you get when you download garmin connect weight data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Login to https://connect.garmin.com/ & Navigate to 'Health Stats > Weight > 1 Year' | |
# at the top there is an export, that'll get you the csv. | |
# but the csv is in a poor format, with the date on the row above the data - this will reformat it for you | |
$weight = import-csv 'C:\Users\JessPomfret\Downloads\Weight.csv' | |
$counter = 0 | |
$final = $weight.foreach{ | |
if ( ($counter % 2) -eq 0) { | |
$date = $psitem.time.trim() | |
} else { | |
[PSCustomObject]@{ | |
'Date' = $date | |
'Time' = $psitem.Time | |
'Weight' = $psitem.Weight | |
'Change' = $psitem.Change | |
'BMI' = $psitem.BMI | |
'Body Fat' = $psitem.'Body Fat' | |
'Skeletal Muscle Mass' = $psitem.'Skeletal Muscle Mass' | |
'Bone Mass' = $psitem.'Bone Mass' | |
'Body Water' = $psitem.'Body Water' | |
'WeightDate' = $psitem.WeightDate | |
} | |
} | |
$counter++ | |
} | |
$final |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment