XML is everywhere in enterprise software. ERP systems export data in XML. Government open data portals publish XML feeds. Configuration files, product catalogs, financial reports, and API responses all use XML. Getting that data into Excel for analysis almost always requires a conversion step.

Unlike CSV or JSON, XML has a flexible hierarchical structure — elements can be nested arbitrarily deep, and data can live in attributes or in element content. This flexibility makes XML powerful and also makes conversion to a flat table format like Excel non-trivial. Here’s how to handle it.

Understanding XML Structure

The structure of your XML determines how the converter maps it to rows and columns.

Simple flat XML (converts cleanly):

<?xml version="1.0" encoding="UTF-8"?>
<employees>
  <employee>
    <name>Alice</name>
    <department>Engineering</department>
    <salary>95000</salary>
  </employee>
  <employee>
    <name>Bob</name>
    <department>Marketing</department>
    <salary>72000</salary>
  </employee>
</employees>

Each <employee> element becomes a row. Child elements (<name>, <department>, <salary>) become columns.

Nested XML (requires more care):

<orders>
  <order id="ORD-001" date="2026-01-15">
    <customer>
      <name>Alice</name>
      <email>alice@example.com</email>
    </customer>
    <total currency="USD">450.00</total>
  </order>
</orders>

Here data lives in both attributes (id, date, currency) and nested elements (<customer><name>). Handling this correctly requires a converter that understands XML attributes and can flatten nested elements.

Method 1: Convert XML to Excel Using TableConvert

TableConvert’s XML to Excel converter handles XML parsing and table mapping in your browser — no software installation needed.

Step 1: Open the Converter

Go to tableconvert.com/xml-to-excel.

Step 2: Paste Your XML or Upload a File

In the Data Source panel:

  • Paste: Click the text area and paste your XML content directly
  • Upload: Click the Upload File button and select a .xml file

Use the Example button to load sample XML data if you want to explore the interface first.

Step 3: Review the Parsed Table Structure

TableConvert parses the XML and displays the result in a table editor. Check that:

  • The column headers match the element names and attribute names you expect
  • Row count aligns with the number of repeating elements in your XML
  • Nested element paths appear as dot-notation headers (e.g., customer.name, customer.email)

If the table structure doesn’t look right, your XML may have an unusual nesting pattern. See the troubleshooting section below.

Step 4: Download the Excel File

Click Download to save a .xlsx file. The file opens directly in Excel with column headers in row 1.

Method 2: Import XML Directly into Microsoft Excel

Excel 2007 and later can import XML natively using the Developer tab.

Enabling the Developer tab (if not visible):

  1. Go to File > Options > Customize Ribbon
  2. Check Developer in the right panel and click OK

Importing XML:

  1. Go to Developer > Import
  2. Select your .xml file
  3. If Excel prompts you to create an XML Map, click OK
  4. Excel infers the table structure and imports the data

Alternatively, use Data > Get Data > From File > From XML (Excel 2016+), which routes through Power Query and gives you more control over the mapping.

Limitation: Excel’s XML import works best with flat or moderately nested XML where there’s a clear repeating element. Complex or deeply nested XML often requires manual mapping adjustments.

Simple XML vs Nested XML: What to Expect

The complexity of the conversion scales directly with the depth and irregularity of your XML structure.

XML StructureConversion DifficultyTableConvert Handles It?Notes
Flat elements onlyEasyYesDirect row-column mapping
Elements + attributesEasyYesAttributes become columns
One level of nestingModerateYesDot-notation column headers
Multiple levels of nestingHardPartialDeep nesting may need preprocessing
Mixed text + child elementsHardPartialUnusual XML design pattern
Repeating arrays of arraysVery hardNoRequires custom transformation

For deeply nested XML, preprocessing in Python (using xml.etree.ElementTree or lxml) gives you full control over the flattening logic before the data reaches Excel.

Common XML Conversion Issues

Namespaces in column names: XML namespaces appear as prefixes in element names: <ns0:employee xmlns:ns0="http://example.com/schema">. After conversion, your columns may be named ns0:name instead of just name. Most converters strip namespaces automatically, but if they don’t, a quick find-and-replace in Excel fixes it.

Attributes being ignored: Some converters only parse element text content and skip XML attributes (id="ORD-001"). If your XML stores important data in attributes, verify the converter handles them. TableConvert includes attribute values as columns.

Character encoding: XML files should declare their encoding in the XML declaration: <?xml version="1.0" encoding="UTF-8"?>. If the file is encoded differently from what’s declared, special characters may appear garbled. Open the file in a text editor and verify the encoding before converting.

Self-closing tags: <salary /> and <salary></salary> are equivalent in XML. Both should map to an empty cell. If one produces different output than the other in your converter, that’s a parser bug — use a different tool.

Large files: Very large XML files (100MB+) can be slow or impossible to process in a browser-based tool. For large files, use a command-line tool or Python script to process the conversion server-side.

A Python Alternative for Complex XML

When browser-based conversion isn’t enough, Python handles arbitrary XML structures:

import xml.etree.ElementTree as ET
import pandas as pd

tree = ET.parse('employees.xml')
root = tree.getroot()

rows = []
for employee in root.findall('employee'):
    row = {child.tag: child.text for child in employee}
    # Include attributes
    row.update(employee.attrib)
    rows.append(row)

df = pd.DataFrame(rows)
df.to_excel('employees.xlsx', index=False)

This approach gives you complete control over which elements and attributes become columns, and how to handle nested structures.

Start Converting

For most XML files, TableConvert’s XML to Excel converter handles the conversion immediately — paste or upload your XML and download the Excel file. For deeply nested or irregular XML, the Python approach above lets you define exactly how the hierarchy maps to your spreadsheet structure.