Data Import & Export

Why XML Data Loads into Multiple Rows in Excel & How to Fix It

Olivia MillerOlivia Miller Oct 29, 2026 869 views

Question details

The user is experiencing an issue where XML files from the same source generate different row layouts or load into multiple rows unexpectedly during import.

Why XML Data Loads into Multiple Rows in Excel
Product
Excel
Device & OS
not provided
Scenario
Importing XML data files into a spreadsheet using the Developer tab or standard import tools.
Observed behavior
The spreadsheet application creates different and inconsistent row layouts for the imported XML data, often splitting data into multiple rows.
Before you start

Ensure you have access to the original XML files and a basic text editor (like Notepad) to inspect the raw XML code before importing.

Solution 1Recommended

Use Power Query to Compare and Transform XML Data

Importing your XML files via Power Query allows you to flatten nested nodes and correct structural discrepancies before loading the data into Excel.

XML files use hierarchical structures. Even minor differences in nesting, optional nodes, or namespaces can force Excel to create a new layout. Power Query gives you manual control over how these hierarchies are flattened into rows.

1
Open Power Query

Go to the Data tab on your ribbon, click on 'Get Data', select 'From File', and then choose 'From XML'.

2
Select the XML File

Browse to the location of your first XML file, select it, and click 'Import'.

3
Transform the Data

Instead of loading the data directly, click 'Transform Data'. This opens the Power Query Editor where you can view the exact table structure.

4
Expand Nested Nodes

Look for columns containing 'Table' or 'Record' values. Click the expand icon (two diverging arrows) at the top of the column to flatten repeating elements into single rows.

5
Load to Spreadsheet

Once the data is formatted correctly, click 'Close & Load' to bring the clean, structured data into your worksheet.

Use Power Query to Compare and Transform XML Data
Pro Tip: Perform these same steps for the second XML file. By comparing the queries side-by-side, you can easily spot which namespaces or nested nodes are causing the multiple row variations.
Free Microsoft Office alternative

Try WPS Office for Seamless Data Management

If complex XML schema mapping and formatting issues in Microsoft Excel are slowing down your workflow, consider using WPS Office. It provides a lightweight, highly compatible spreadsheet environment that makes everyday data handling straightforward and intuitive.

  1. 1. Download WPS Office: Visit the official WPS website and download the free installation package.
  2. 2. Install and Launch: Follow the simple on-screen instructions to install the software, then open WPS Spreadsheets.
  3. 3. Import Your Data: Use the Data tab to easily import, format, and manage your datasets without complex schema conflicts.
Highly compatible with standard Microsoft Office formats including .xlsx, .csv, and .xmlLightweight installation ensures fast performance without consuming massive system resourcesFamiliar user interface makes transitioning from other spreadsheet software instant and easyCompletely free to download and use for all your core data processing needs
microsoft office alternative - wps office

Frequently Asked Questions

What causes an XML file to change layout upon import?

Differences in element hierarchy, nested nodes, optional nodes, or repeating items can force the spreadsheet application to generate a new layout to accommodate the changing data structure.

How do I check if my XML file has repeating nodes?

Open the XML file in any basic text editor like Notepad. Look for identical tags nested within a single parent element. These repeating records tell the spreadsheet to create separate rows.

Does a changed namespace affect XML importing?

Yes. If the XML namespace (xmlns attribute) changes, the spreadsheet application treats the tags as entirely new elements. This often breaks the existing XML schema map and creates unexpected rows or layouts.

Can I prevent data from splitting into multiple rows?

Yes, but you need to flatten the XML hierarchy before importing. The best way to achieve this is by using the Power Query tool to expand nested tables and records into single, standardized columns.