Why XML Data Loads into Multiple Rows in Excel & How to Fix It
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.

- 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.
Ensure you have access to the original XML files and a basic text editor (like Notepad) to inspect the raw XML code before importing.
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.
Go to the Data tab on your ribbon, click on 'Get Data', select 'From File', and then choose 'From XML'.
Browse to the location of your first XML file, select it, and click 'Import'.
Instead of loading the data directly, click 'Transform Data'. This opens the Power Query Editor where you can view the exact table structure.
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.
Once the data is formatted correctly, click 'Close & Load' to bring the clean, structured data into your worksheet.

Manually Inspect and Standardize the XML Schemas
By reviewing the raw text of the XML files, you can identify differing parent elements or repeating records that are causing the layout changes.
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. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install and Launch: Follow the simple on-screen instructions to install the software, then open WPS Spreadsheets.
- 3. Import Your Data: Use the Data tab to easily import, format, and manage your datasets without complex schema conflicts.

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.




