Skip to content

Instantly share code, notes, and snippets.

@jpomfret
Last active July 29, 2022 08:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpomfret/aa6451f80d0ea5534df349221e8c3c1d to your computer and use it in GitHub Desktop.
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
# 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