How to Export Apple Health Data on iPhone Using Shortcuts

Update Jan 8th, 2022: Health Auto Export supports direct integration and upload to Dropbox

Health Auto Export provides several options through which you can back up your Apple Health data. The most recent of those is the ability to trigger exports using Shortcuts.

While some power users may be extensively familiar with how to create and take advantage of shortcuts, not everyone falls into that category, and this post is here to help out those of you who aren’t. Follow along to find out how you can set up Apple Health exports to iCloud Drive, Dropbox, Google Drive, or any app that integrates with the Files app, using Shortcuts.

IMG_D8D5FE407B4B-1.jpg

Step 1:

Open the Shortcuts app then select the Automation tab.

Tap the + button in the top right of the navigation bar to start creating an automation.

Select Create Personal Automation.

IMG_F310449ECBD9-1.jpg

step 2:

You can select any of several trigger mechanisms for your automation. In this tutorial, we’ll select the Time of Day trigger.

IMG_B8E4A19FB6EC-1.jpg

STEP 3:

Next, you can select the time of day you’d like the trigger to fire, and how often you’d like the automation to repeat.

Let’s set up a weekly automation that runs every Sunday at 8:00 PM.

By default, all days are selected. In the day selector at the bottom of the screen, tap the circles for the days you want to disable.

Click Next.

IMG_2991.jpg

Step4:

Time for the really fun stuff…

Select Add Action to begin adding steps the the shortcut automation.

You can search for the Create Folder action, then tap on it to add it to the shortcut.

IMG_2994.jpg

Step 5:

Now you can configure options for where we will create and store backups when the automation is run.

For the Service parameter, you can use iCloud, Dropbox, Google Drive, or your preferred storage service provider.

In this case, select Dropbox.

For the Path parameter, you can then specify where the folder will be created. Create a Health Export backups folder by specifying the path as follows: /Backups/

Click the + button below to add another step.

IMG_2995.jpg

Step 6:

Now, search for the Health Auto Export shortcuts.

Select the Run Health Export action.

As noted on the shortcut information tab, Shortcuts are intended to be lightweight and run quickly, thus they are limited to 10 seconds execution time 30 MB memory. You should, therefore, aim to design your shortcuts with this in mind.

Don’t try to back up months worth of data using a shortcut. Aim for monthly, weekly or daily backups.

IMG_2997.jpg

Step 7:

Select the metrics you would like to backup. In this example, Active Energy, Heart Rate and Step Count have been selected.

Tap the Show More disclosure, for additional options.

Select “Hours” for Aggregation, and select “Previous 7 Days” for the Period.

These settings will result in a shortcut that exports data for the previous 7 full days on a weekly recurring basis.

IMG_2999.jpg

Step 8:

Click the + button to add another action. Search for the Save File action, then select it.

This action will take the output from the previous step—the generated health data files—and save them to a specified location.

Once again, select the storage service provider. This should be the same selection as in Step 5.

Disable the Ask Where To Save option, then set the Destination Path parameter to match the Path parameter from Step 5 (/Backups/).

For most people leaving Overwrite if File Exists enabled should be the preferred option, but It can be disabled if you want to have multiple versions of an export.

Select Next in the top right navigation.

IMG_3003.jpg

Step 10:

You have an opportunity to review the configuration of your shortcut before adding it on this screen.

It is strongly recommended that you leave Ask Before Running enabled.

Even though automations can run without any intervention on your part, iOS comes with the limitation that Apple Health data is encrypted and inaccessible when your device is locked.

This means that if the automation is triggered at a time when your phone is locked, no data will be backed up.

Select Done, and that’s it! You’ve created a simple but powerful automation that can backup your Apple Health data on a weekly basis.

You can repeat these steps for the Workouts shortcut in Health Auto Export to back up Workout data as well.

Personal automations cannot be shared via iCloud, however, you can use the link below to download a Shortcut containing the actions mentioned in this article:

Export Apple Health Data to Dropbox

To use the automation mentioned in this post, you will need Health Auto Export to CSV.

If you have any questions, get in touch here.