Data Import & Export

Import Multiple XML Files into Excel with Power Query or VBA

Amos GikundaAmos Gikunda Nov 25, 2026 868 views

Question details

Import and combine multiple similarly structured XML files into an Excel worksheet without opening each file individually.

Import Multiple XML Files into Excel with Power Query or VBA
Product
Microsoft Excel
Device & OS
not provided
Scenario
The user has thousands of XML files and wants to automate their import into Excel.
Observed behavior
Importing files individually is inefficient and may produce an XML map error.
Before you start

Place the XML files you want to combine in one folder and check that they have similar structures. If you use Excel 2010, check whether the Power Query add-in is already installed; its availability may be limited for this older version.

Solution 1Recommended

Combine XML files with the Power Query folder connector

Use this approach when the XML files share a similar structure and you want a refreshable import.

1
Connect to the folder

In newer Excel versions, select Data > Get Data > From File > From Folder. In Excel 2010 with the Power Query add-in installed, use the Power Query tab and select From File > From Folder.

2
Open the query editor

Select the folder containing the XML files, confirm the selection, and choose Transform Data or Edit to open the file list in Power Query.

3
Filter for XML files

Use the filter on the Extension column to keep only .xml files. Remove any unrelated files from the list.

4
Parse and expand the contents

Select Add Column > Custom Column and enter Xml.Tables([Content]) to parse each file. Use the expand buttons on the resulting column and any nested table columns to select the fields you need.

5
Load the combined data

Select Home > Close & Load to load the results into Excel. To import files added to the folder later, use Data > Refresh All.

Combine XML files with the Power Query folder connector
Check nested XML: The columns and expansion steps depend on the XML structure. Files with different layouts may need separate queries or additional transformations.
Free Microsoft Office alternative

Work with Your Combined Spreadsheet in WPS Office

After combining the XML files in Excel, open the resulting workbook in WPS Spreadsheets. WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format support for an easy transition.

Review and edit combined spreadsheet data in WPS SpreadsheetsCompatible with Microsoft Excel XLSX and XLS filesFamiliar spreadsheet interface for everyday editingFree and lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Can Excel 2010 combine XML files with Power Query?

Yes, if the Power Query add-in is installed. Use the Power Query tab and choose From File > From Folder. Availability of the add-in may be limited because Excel 2010 is an older version.

What if my XML files have different structures?

Use separate queries or adjust the transformation steps for each layout. You can also use the From XML connector to inspect individual files before deciding how to combine them.

How do I include new XML files later?

Add compatible XML files to the same folder, then select Data > Refresh All in Excel. The folder query will reprocess files that match its filters.

Will Power Query always fix an XML map error?

No. Power Query parses XML without relying on the same worksheet XML map workflow, but malformed files or inconsistent structures can still require correction or additional transformations.