FitMigrate

Export Apple Watch Sleep Data: Stages and CSV Columns

By Josep Mampel Marques, updated

To export your Apple Watch sleep data, export all your Health data from the iPhone and convert the Sleep Analysis type to CSV with FitMigrate. The Health app has no export for sleep alone. The CSV has one row per period with start date, end date, a label in the value column and the source, so you can see when you were in bed, awake or in a sleep stage. Apple's sleep stages are Awake, REM, Core and Deep. FitMigrate copies what Apple stored and does not interpret it.

Steps

  1. On the iPhone open Health, tap Summary, tap your picture and choose Export All Health Data. See the full steps.
  2. Open the export.zip in FitMigrate on a computer.
  3. Under Metrics to CSV tick Sleep Analysis.
  4. Click Download selected as CSV and open the file in your spreadsheet.

What the sleep stages are

Apple's support page says that if you wear the watch to bed, Apple Watch can estimate the time you spent in each sleep stage, REM, Core and Deep, as well as when you may have woken up. In the Health app on the iPhone you can see time and percentage in Awake, REM, Core and Deep. If you do not wear the watch to sleep, the record can be incomplete, and Sleep Tracking has to be on for the watch to add sleep data to Health.

Reading the CSV

Sleep rows have labels instead of numbers. In an export they use Apple's own names, which begin with HKCategoryValueSleepAnalysis followed by the label. Typical endings are InBed, Awake, AsleepCore, AsleepDeep and AsleepREM. Older data or data from other apps may use a plain asleep label, and which ones you see depends on your devices and iOS version.

ColumnMeaning
startDate, endDateThe period, with the time zone offset
valueThe label for that period
unitEmpty for sleep, because it is category data
sourceNameThe device or app that wrote the row

Duration per night in a spreadsheet

  1. Subtract start from end for each row. The formula and the date handling are in the spreadsheet guide.
  2. Filter the value column to the labels you want to count, for example only the asleep ones.
  3. Group by the date of the end time, so a night that crosses midnight is counted once.

Check the sourceName column first. If an iPhone sleep schedule and an Apple Watch or another app both wrote rows for the same night, adding up everything counts that night twice. Filter to one source before you total. The reason sources can overlap is explained in Apple Health data sources and duplicates.

Large exports and import limits

Sleep produces fewer rows than heart rate, but a multi-year history can still be thousands of rows. Excel and Google Sheets both import CSV; the specific steps and limits are in Apple Health export to CSV.

What FitMigrate does not do

Moving to another watch

If you are changing brand, your sleep history will not transfer into the new service as sleep. Keep the CSV as your record. The same is true for steps and weight: see switching from Apple Watch to Garmin for what does move.

FAQ

Can I export just my sleep from the Health app?

No. Export All Health Data gives you everything in one export.zip. You then pick Sleep Analysis when you convert it to CSV.

Why does my sleep CSV have no unit?

Sleep is category data: each row has a label such as a sleep stage in the value column instead of a number, so the unit is empty.

Why are some nights split into many rows?

Each row is one period. When the stage changes, a new row starts, so a night with several stages has several rows.

Sources