How can I migrate Google Fit activity data to Apple Health?

Is there a first-party way of doing this? I exported all my data from Google using the Google Takeout interface, but this produced a zip file, which iOS cannot open. I also cannot install Google Fit on my iPhone to be able to import the data at the application level (it is not available in the Appstore).

How do I get the data into Apple Health?


With a combination of this app and a small python script I'll paste below I was able to import all my step, heart rate and weight data from the last 8ish years without any problems.

Just change the columns you want to keep in the list at the top and execute the script with the path to the "Daily activity metrics" folder as a parameter. I moved the "Daily activity metrics.csv" file in the folder away since it'll otherwise append it to the end of the CSV with the timestamp missing.

import os, sys, csv

COLUMNS_TO_KEEP = [
    "Start time",
    "End time",
    "Distance (m)",
    "Average heart rate (bpm)",
    "Step count",
    "Average weight (kg)",

]

input_path = sys.argv[1]
if not os.path.isdir(input_path):
    print("%s is not a valid directory" % input_path)
    sys.exit(1)
input_path = os.path.abspath(input_path)

data = []

for f in sorted(os.listdir(input_path)):
    with open(os.path.join(input_path,f)) as infile:
        date = os.path.splitext(f)[0]
        reader = csv.reader(infile)
        columns = []
        for row in reader:
            if columns == []:
                columns = row
                continue
            tmp = []
            for pos, cell in enumerate(row):
                if columns[pos] in COLUMNS_TO_KEEP:
                    if "time" in columns[pos]:
                        cell = "%s %s" % (date, cell)
                    tmp.append(cell)
            if any(tmp[2:]): # only append data if any of the value columns have a value
                data.append(tmp)

with open("consolidated_fit_data.csv", "w") as outfile:
    writer = csv.writer(outfile)
    writer.writerow(COLUMNS_TO_KEEP)
    writer.writerows(data)

And yes, I'm aware that the code is rather single-case but that was kinda the point for me.