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
- On the iPhone open Health, tap Summary, tap your picture and choose Export All Health Data. See the full steps.
- Open the export.zip in FitMigrate on a computer.
- Under Metrics to CSV tick Sleep Analysis.
- 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.
| Column | Meaning |
|---|---|
| startDate, endDate | The period, with the time zone offset |
| value | The label for that period |
| unit | Empty for sleep, because it is category data |
| sourceName | The device or app that wrote the row |
Duration per night in a spreadsheet
- Subtract start from end for each row. The formula and the date handling are in the spreadsheet guide.
- Filter the
valuecolumn to the labels you want to count, for example only the asleep ones. - 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
- It does not score your sleep or tell you if it is good or bad. For questions about your sleep or health, talk to a doctor or other qualified professional.
- It does not merge sources or remove overlapping rows.
- It does not produce a sleep chart. The CSV is for your own charts.
- Nothing is uploaded; the file is built in your browser.
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
- Apple Support: Track your sleep on Apple Watch and use Sleep on iPhone
- Apple Support: Share your data in Health on iPhone (iPhone User Guide)
- Apple Support: Manage Health data on your iPhone, iPad, or Apple Watch
- Microsoft Support: Import or export text (.txt or .csv) files
- Google Docs Editors Help: Import data sets & spreadsheets