How to export Apple Health data to Files with Shortcuts
Build a shortcut with two actions: Export Health Data, from Health Exporter & Shortcuts (a paid iPhone app, US$2.99 once on the App Store), then Save File, pointed at the folder you want. Run it from a personal automation whose trigger fires while your iPhone is unlocked, because iOS makes Health data unreadable a few minutes after the phone locks. The folder can be in iCloud Drive, in another app that shows up in Files, or On My iPhone.
It takes about two minutes, and every action and parameter below is named exactly as it appears in Shortcuts. Health Exporter adds two more actions, Export Workouts and, from version 1.8.0 on iOS 26 and later, Export Medications, which work the same way.
Save your exports to a folder in Files #
- Open Health Exporter once and allow access to the Health data you want to export. A shortcut cannot ask for that permission on its own, so it must be granted in the app first. When a later update can export a kind of data you have not been asked about yet, the shortcut keeps running with what it can read, lists the missing types under
pendingAuthorizationsin the file, and a quiet notification invites you to open the app and allow them. - Open the Shortcuts app and create a new shortcut.
- Add the Export Health Data action. Search for “Health Exporter” and pick it from the list.
- Set what to export:
- Period is one of Yesterday, Last 7 Days or Last 30 Days. The default is Last 7 Days. By default the day in progress is included too, through Include Today.
- Export All Types is on by default. Turn it off and a Data Types list appears, where you choose only the types you want, for example steps and sleep. The list offers Heart Rate Variability (RMSSD) on every iOS, but only iOS 27 and later has it: on an earlier iOS the export leaves it out and carries on with the other types. If it is the only type you chose, there is nothing left to export, and the action stops with a message saying it needs iOS 27 or later.
- Use Custom Range swaps the preset period for a Start Date and an End Date. They can be fixed dates or variables from earlier actions. The range cannot be longer than 2 years.
- Add a second action, Save File, right below it. It receives the file from the export action as its input.
- Choose where the file goes. In the Save File action, pick the destination folder: a folder in iCloud Drive, a folder in another app that appears in Files, or one on your iPhone.
- Decide whether the shortcut should ask each time. The Save File action has an option that makes it ask where to save every time it runs. Turn it off to save straight to the folder you picked, which is what you need for an automation. Leave it on if you prefer to choose the folder on each run.
- Run the shortcut once by hand, then open the Files app and look in the folder you chose: the JSON file is there.
The exported file is standard JSON, and dates inside it use ISO 8601. The JSON guide shows a complete file, and the format reference describes every key.
Exporting workouts #
Export Workouts works the same way. Put it first and follow it with Save File, exactly as above. It has the same Period, Include Today, Use Custom Range and Export All Types parameters. Where Export Health Data has Data Types, it has Activity Types to pick the kinds of workout.
It also has one parameter of its own, GPS Route, with three choices: No route (the default), JSON only and JSON + GPX (zip). With JSON + GPX (zip) the result is a zip archive that holds the workout JSON and one GPX file per workout, so Save File stores a zip rather than a JSON file. Routes are dense, so a wide period can produce a very large file. The GPX guide describes what the archive contains.
Exporting medications #
Export Medications, from version 1.8.0, on iOS 26 and later, works the same way too, with the same Period, Include Today and Use Custom Range parameters. It has no list of types: it exports the doses of the medications you chose to share with the app, and a shortcut cannot show the list in which you choose them. So open Health Exporter first, go to the Medications tab and tap Choose Medications. Until you have, the action exports no doses, lists HKDataTypeUserAnnotatedMedicationConcept under pendingAuthorizations in the file, and a quiet notification invites you to open the app and choose. The medications format reference describes the file.
Make it run on its own #
A shortcut you have to start by hand is only half of the idea. In the Automation tab of the Shortcuts app you can create a personal automation that runs your shortcut on a trigger, for example every morning, and saves a fresh export to your folder with no taps.
To set one up:
- Open the Automation tab and create a new personal automation.
- Choose a trigger, then choose the shortcut you just built as the action to run.
- Choose how it runs: immediately, with no tap, or after you confirm, in which case iOS sends you a notification to tap first. Which one fits depends on whether the phone will be unlocked when the trigger fires: see below.
Keep the phone unlocked when it runs #
Apple protects the data in Health while your iPhone is locked. A few minutes after the phone locks, no app can read it, Health Exporter included, and it stays unreadable until you unlock the phone again. This is a rule of iOS, not a permission you can grant. An automation that fires while the phone has been locked for a while fails with “Health data cannot be read while the device is locked”, or, in older versions, with “Protected health data is inaccessible” or without returning any data.
There are two ways around it:
- Confirm before it runs, with any trigger and at any hour. Shortcuts sends a notification at the scheduled time; you tap it, unlock the phone, and the export runs. This is the dependable choice for a fixed time such as every evening.
- Run it immediately, with a trigger that fires while the phone is in your hand: the App trigger set to Is Opened, for an app you open every morning, or a time of day when your phone is normally unlocked. Nothing to tap, but it fails whenever the phone happens to be locked.
The Support page has the full explanation, including the triggers to avoid.
Where to go next #
- The Support page answers the common questions about permissions, export periods and data types.
- The AI assistant guide covers what to do with the file once it is in Files, if you want to ask an assistant about it.
- The Privacy Policy explains what the app reads and where the file goes: nowhere but the place you save it.