What you will need:
- Your RunKeeper data that you can get here.
- Scriptable installed on your iPhone.
- Microsoft Excel.
- The CSV to JSON conversion code, included in this Shortcut.
1) Getting your RunKeeper data
Easy, login to your RunKeeper account and get your data.
After some processing on the website you should be able to download your data and you should get a zip file.
Inside the zip file you may find some GPX files with your workout location tracking but what we want to get the data for Apple Health is the “cardioActivities.csv” file.
Note: To use the Shortcut from this post without any modification please rename this file to “RKcardioActivities.csv”.
2) Fixing the CSV data
In my CSV file the duration was an issue because it wasn’t in a consistent unit (hours, minutes, etc).
In line 2, 1 hour of walking has a duration value of 01:00:00, quite logic, ok but 30 minutes of swimming has a duration value of 30:00:00 which can make the Log Workout action in Shortcuts very confused.
To fix the data above I have tried a few different solutions and what worked for me was to convert the duration to seconds using the VBA code below:
Function toSeconds(str As String) strT = Split(str, ":") toSeconds = CDbl(strT(0)) * 3600 + CDbl(strT(1)) * 60 + CDbl(strT(2)) End Function
3) Putting the data on your iPhone
When you have Scriptable installed on your phone the app will create a folder in your iCloud Drive named, not surprisingly, Scriptable. The Javascript code and the Shortcut that I created will look for the CSV file in a subfolder of Scriptable that I have named ‘storage’. So if you would like to use the Shorcut without any modification just create a ‘storage’ folder inside the Scriptable folder and copy your “RKcardioActivities.csv” file inside it.
4) Create the Shortcut
This is the easy part because I have created it already but there are some limitations (of course). This shortcut can only recognise a few types of activities (the ones that I had in my CSV file), they are:
- Walking
- Strength Training (or Traditional Strength Training in Apple Health)
- Running
- Swimming
- Cycling
- Mountain Biking (or Cycling in Apple Health)
- Skating (or Skating Sports in Apple Health)
- Rowing
Run the Shortcut and allow it the access to the data, I recommend that you first try importing only a couple of your activities at a time to check if it’s being done properly, especially for the duration. Then, once it’s ok, remove the redundant information and import everything.
To check the results you can go to the “Apple Health app > Workouts (scroll down) > Data Sources & Access (scroll down) > Shortcuts” and your imported data will be shown in there.
I had about 1,000 activities logged in RunKeeper and the Shortcut took about 30 seconds to run so you can have an idea of the performance on an iPhone SE 2020 .
Hope this helps.
Keep coding!