# Convert an XML file to Excel, totals and all

> Markdown version of https://stella.sh/how/pdf-excel/convert-xml-to-excel for agents and LLMs.
> Open an XML file in Excel with Power Query, or let Stella (stella.sh) turn an iPhone Health export into a spreadsheet of daily step totals and weights, on your computer.

Excel for Windows reads XML through Data, Get Data, From File, From XML; you then filter and group the records yourself. For exports like the iPhone Health one, the catch is that the XML holds thousands of small records, so a day's steps are spread over many rows and need adding up. Stella (stella.sh) unzips the export, adds them up per day and lays the result out in a spreadsheet.

- Checked: 14 November 2026
- Stella does it on: Windows, Mac, Linux

## Stella doing it

Recorded 14 November 2026 on Linux (Omarchy) with Claude Code with Opus, on a Claude plan.
Result: A two-tab spreadsheet in about 2 minutes. Checked afterwards against an answer key written before the run: total steps exactly right for all 92 days (every record of each day added up), and all 15 weight readings with their dates. The health data is fictitious, generated for this run in the Health export's real structure (zip, export.xml, record types and dates). The work is sped up 7×.

Video (48 s): https://stella.sh/media/proofs/pdf-excel/convert-xml-to-excel/proof.mp4

Transcript:

- 0:00 Stella on a Linux computer. An iPhone Health export, export.zip, is in Downloads.
- 0:01 The prompt: a spreadsheet with total steps for each day and all the weight readings.
- 0:15 Stella replies that it will make a tab for steps and one for weight, without counting steps twice.
- 0:20 Reading the XML and adding up each day, sped up 7×.
- 0:33 Done: a total for every day from July to September and all 15 weight readings.

What Stella does:

1. Finds export.zip in Downloads and reads the export.xml inside, which Health writes as one long list of records grouped by type, not by date
2. Picks out the step-count records from among thousands of heart-rate and walking-distance ones, and checks whether a phone and a watch both counted steps (here only the iPhone did, so nothing needed removing)
3. Adds every step record of each day into one daily total, for all 92 days from 1 July to 30 September
4. Lists every weight reading with its date, in pounds as recorded
5. Saves “Apple Health - Steps and Weight.xlsx” next to the zip, with a tab for steps and one for weight, and mentions the highest and lowest days

## The prompt to paste

```text
I exported my health data from my iPhone, it's the zip in my Downloads, and inside is an XML file I can't open. Make me a spreadsheet with my total steps for each day and all my weight readings.
```

## Open it in Excel yourself

1. **Get the export onto your computer.** On the iPhone: Health app, your picture, Export All Health Data. Send the zip to your computer (AirDrop, Files, email to yourself if it's small) and unzip it. The data is in apple_health_export/export.xml.
2. **Windows: Excel's XML import.** Data, Get Data, From File, From XML, and pick export.xml. Choose the Record table and Transform Data. Filter the type column to HKQuantityTypeIdentifierStepCount.
3. **Total each day.** Add a column with the first 10 characters of startDate (the date), change the value column to a number, then Group By that date with Sum of value. Close & Load. Repeat with BodyMass for weight, without grouping.
4. **On a Mac.** Numbers can't read the export, and Excel for Mac's XML support is limited. The Power Query steps above work in recent Microsoft 365 builds of Excel for Mac (Data, Get Data); otherwise use a Windows PC or a script.

## Where Stella stops

- When an iPhone and a watch both count steps, the export holds both and a plain sum counts the overlap twice; the Health app hides that. Stella checks for two step sources and says what it did. In this run there was only one.
- Real exports can be several GB after years of data. Stella reads them in a stream, but it takes a few minutes.
- Stella looks at the structure and a sample of the records; the totals are worked out on your computer, so your full health history isn't sent to the AI model.
- Recorded on Linux with Python's built-in XML reader. A Mac or Windows PC works the same way.

## Questions

**How do I open an XML file?**
Any text editor or browser shows it, but as raw tags. To get a table, use Excel's Get Data, From XML on Windows, or ask Stella for the columns you want.

**Can I do this for other XML files, not just Health?**
Yes. Bank, accounting and shop exports often come as XML; the steps are the same: pick the repeating record, choose columns, and total where needed. For JSON exports, see [convert JSON to Excel](https://stella.sh/how/pdf-excel/convert-json-to-excel).

**Can it show weekly or monthly averages too?**
Yes, ask for them. Or use [summarize a spreadsheet by category](https://stella.sh/how/pdf-excel/summarize-spreadsheet-by-category) on the daily totals.

**Is Stella free for this?**
Yes. Free with the ChatGPT or Claude plan you already have. Sign in with your ChatGPT plan, or use your Claude plan through Claude Code, and this task costs nothing extra. New accounts also get a small free trial of Stella’s own models.

**Can I control what Stella changes on my computer?**
Yes. Stella works on Windows, Mac and Linux with your own files and shows each step in the chat, so you can watch it and stop it at any point. Tell it what it may not do, as the prompts on these pages do (“don't delete anything without asking”). In the Downloads recording it deleted nothing until it was told to go ahead. It also refuses commands that would wipe a whole disk, your home folder or system folders.

Sources: [Apple: Share your health data (export) on iPhone](https://support.apple.com/guide/iphone/share-your-health-data-iph5ede58c3d/ios), [Microsoft: Import XML data](https://support.microsoft.com/en-us/office/import-xml-data-6eca3906-d6c9-4f0d-b911-c736da817fa4).

## Related problems

- [Convert a JSON file to Excel you can actually read](https://stella.sh/how/pdf-excel/convert-json-to-excel.md)
- [Convert a text file to Excel, each column in its own column](https://stella.sh/how/pdf-excel/convert-text-file-to-excel.md)
- [Summarize a spreadsheet by category and month, with totals](https://stella.sh/how/pdf-excel/summarize-spreadsheet-by-category.md)
- [Change dates in Excel from US to UK when they come out wrong](https://stella.sh/how/pdf-excel/fix-dates-in-excel.md)
- [Convert bank statement PDFs to Excel](https://stella.sh/how/pdf-excel/bank-statement-pdf-to-excel.md)
- [Reduce PDF file size when it's too large to email](https://stella.sh/how/pdf-excel/compress-pdf-too-large-to-email.md)

Get Stella: https://stella.sh/download. Free with the ChatGPT or Claude plan you already have.
