Export sleep data from Apple Watch
Sleep sits in Apple's export as HKCategoryTypeIdentifierSleepAnalysis records, one per stage segment, and the free converter turns them into a CSV with the stage name in the value column. For hours per night, select Sleep Stages in HealthSave's Export tab: it adds one sleep_total row for each night.
Where Apple's export file keeps sleep
A sleep record has no number. Its value names the stage, and its start and end times give the segment's length.
| Record type | HKCategoryTypeIdentifierSleepAnalysis |
|---|---|
| Unit | none; the stage is the value |
| Values | HKCategoryValueSleepAnalysisAsleepCore, HKCategoryValueSleepAnalysisAsleepDeep, HKCategoryValueSleepAnalysisAsleepREM, HKCategoryValueSleepAnalysisAwake, HKCategoryValueSleepAnalysisInBed, HKCategoryValueSleepAnalysisAsleepUnspecified |
| One record covers | one segment of one stage, from startDate to endDate |
Your iPhone can write In Bed records from your sleep schedule while Apple Watch writes the stages. Both land in the file, each with its own source.
Convert sleep in your browser
The free Apple Health to CSV converter reads your export.zip or export.xml on your own device, uploads nothing, and writes one CSV per record type with the columns startDate, endDate, value, unit and source.
Open the converter for Sleep Analysis records →
startDate,endDate,value,unit,source
2026-11-02 22:40:00 +0000,2026-11-03 06:50:00 +0000,HKCategoryValueSleepAnalysisInBed,,Example iPhone
2026-11-02 23:05:00 +0000,2026-11-03 00:20:00 +0000,HKCategoryValueSleepAnalysisAsleepCore,,Example Watch
2026-11-03 00:20:00 +0000,2026-11-03 01:05:00 +0000,HKCategoryValueSleepAnalysisAsleepDeep,,Example Watch
2026-11-03 01:05:00 +0000,2026-11-03 01:12:00 +0000,HKCategoryValueSleepAnalysisAwake,,Example Watch
2026-11-03 01:12:00 +0000,2026-11-03 02:00:00 +0000,HKCategoryValueSleepAnalysisAsleepREM,,Example WatchMade by the converter from made-up readings. The unit column stays empty for sleep. The first row is the phone's In Bed span around the watch's stages.
The converter does not add durations. Subtract startDate from endDate in your spreadsheet, and leave the In Bed and Awake rows out when you add up sleep.
Export sleep with HealthSave on your iPhone
In HealthSave, open Export, set the dates, choose CSV or JSON, select Sleep Stages under Metrics, then tap the export button.
| Metric column | sleep_core, sleep_deep, sleep_rem, sleep_awake, sleep_in_bed, sleep_asleep, plus sleep_total |
|---|---|
| Unit column | hours, rounded to two decimals |
| Stage rows | one per segment, dated at its start |
sleep_total rows | one per night, with overlapping segments merged and Awake and In Bed left out |
| Which night | a segment that starts before noon counts toward the night before |
CSV and JSON exports of up to seven calendar days are free, and longer ranges need Pro, a one-time purchase ($24.99 in the US).
The CSV columns are Date, Metric, Value, Unit, Source, Date (YYYY-MM-DD), Time (HH:MM:SS), Time Zone, then seven medication columns, which stay empty unless you export medications.
HealthSave has no account and no HealthSave cloud: your health data leaves the phone only in a file you export, a sync to a destination you set up, or Apple's cloud model for the Weekly Brief if you turn it on.
Limits of both files for sleep
- Stages appear only when the source recorded them. A night saved without stages exports as
sleep_asleepin HealthSave and asHKCategoryValueSleepAnalysisAsleepUnspecifiedin the converter's file. - A nap that starts after noon joins the total of the night that follows it in
sleep_total. - The converter keeps every source. If your watch and another sleep app both wrote the same night, you get both.
Questions about exporting sleep
How do I get total hours slept per night?
Select Sleep Stages in HealthSave and filter the Metric column to sleep_total. Each row is one night with overlaps merged and Awake time left out. From the converter's CSV, add up the durations of the asleep rows for each night yourself.
What does AsleepUnspecified mean?
It marks sleep recorded with no stage. Some apps and older recordings write sleep this way.
Related
- Export HRV data from Apple Watch
- Export respiratory rate data from Apple Health
- Export heart rate data from Apple Health
- Free Apple Health to CSV converter
- Line up sleep, HRV and resting heart rate by date
- Every data type guide