How to Open XML File in Excel

There are two ways to “open xml file in excel”: the quick way you copy and the durable way you understand. This page gives you both. The exact Excel answer is above; below, we build the small mental model that makes the fix stick, so the next variation of the same problem solves itself.

Exact answer

In Excel: to read XML in, use Data ▸ Get Data ▸ From File ▸ From XML for a repeatable import (or File ▸ Open the .xml and let Excel infer a schema); to write XML out, map a schema with Developer ▸ Source ▸ XML Maps ▸ Add and then use Developer ▸ Export.

On this page7
Annotated stepsExcel
1

Open Data ▸ Get Data ▸ From File ▸ From XML and select the file.

2

In the Navigator, pick the repeating element that represents one record.

3

In the Power Query editor, expand nested columns with the arrow on the header; choose Expand to New Rows for repeating children.

4

Remove the columns you do not need and set data types before pressing Close & Load.

5

To export back to XML, add the schema with Developer ▸ Source ▸ XML Maps ▸ Add, drag the elements onto cells, then use Developer ▸ Export.

Ctrl+CthenCtrl+Shift+V+Cthen+Ctrl+VPaste values · WindowsMac

What this does

Excel offers three routes and they suit different jobs. Power Query (Get Data ▸ From XML) parses the file into a table you can expand node by node and refresh later. File ▸ Open reads the file straight into a sheet, inferring a schema and flattening repeated elements, which is quick but not repeatable. The Developer ▸ Source pane maps an XML schema onto specific cells, which is the only route that also exports back out to XML. Before you run it on a workbook other people depend on, try it on a copy or a few rows first. Undo only reaches back through the current session, so a quick trial run is the cheapest way to see exactly what will change before the file is saved and shared. Treat “open xml file in excel” as a small repeatable workflow rather than a one-off click you hope to remember next time. Use a small test block before the live file, so any surprise in the affected cells shows up while it is still harmless. When this is a ribbon command, the selection matters more than the button: confirm the range, apply the command, then spot-check the output before saving. That turns a data step that keeps your analysis trustworthy into a method you can reuse, explain, and defend when the workbook leaves your screen.

A worked example

orders.xml nests several Item elements inside each Order. Data ▸ Get Data ▸ From File ▸ From XML, then click the expand arrow on the Items column and choose Expand to New Rows. Twelve orders become forty-one item rows, and Close & Load writes them to a table that Refresh All updates when the file changes. XML arrives from systems that will send it again next month, so the difference between a one-off open and a refreshable query is the difference between a task and a chore. If this is something you do often, add the command to the Quick Access Toolbar (right-click it on the ribbon and choose Add to Quick Access Toolbar) or learn its shortcut, so next time it is one click instead of a hunt through the menus.

In Google Sheets

This is a command rather than a formula, so there is no syntax to carry over. Google Sheets arranges its commands in menus across the top instead of a ribbon, names some of them differently and does not have every Excel command — look for the equivalent in the Sheets menus or its help before assuming the steps match. The aim was to get you unstuck fast and leave you a little more capable than a copy-paste would. The answer is at the top and the detail above shows why it holds — so the next time a colleague asks, you can answer without reaching for search. Here is the takeaway for “open xml file in excel”: follow the steps at the top, check the result on the sheet itself, and keep undo in mind while you experiment. Done once deliberately, it becomes something you do from memory in Excel rather than something you search for again.

Common mistakes

  • Using File ▸ Open on nested XML and accepting the inferred schema, which flattens repeating elements into columns that no longer line up.
  • Expecting FILTERXML to read a file — it parses XML held in a cell as text, typically fetched by WEBSERVICE.
  • Trying to export to XML without an XML map; a plain sheet has nothing to export against.
  • Ignoring namespaces, which are why an element that is visibly in the file may not appear in the Navigator.

Frequently asked questions

How do I convert an XML file to xlsx?

Import it with Get Data ▸ From XML, then save the workbook as .xlsx. The import stays refreshable against the original file.

Why is my data all on one row?

The repeating element was not expanded to new rows. Use the expand arrow on the nested column and choose Expand to New Rows.

Can Excel write XML back out?

Yes, but only through an XML map: Developer ▸ Source, add the schema, map the elements, then Developer ▸ Export.

What does FILTERXML do?

It runs an XPath query against XML text already in a cell. It is for parsing a fetched string, not for opening a file.

Other ways people ask this

This is also commonly searched as “how can i open xml file with excel”, “how do i open an xml file in excel”, “how do i open xml files in excel” and “how do you open an xml file in excel”. They describe the identical operation, so you are in the right place no matter how you phrased it.

Why do people search for this in so many different ways?

Because the same task has many names. “how can i open xml file with excel”, “how do i open an xml file in excel”, “how do i open xml files in excel” all point at the one operation explained on this page, which is why they all lead here.