How to Import XML Data File into Excel (3 Quick Methods)

Overview of how to import XML data file into Excel

Importing XML data files into Excel allows you to integrate structured data from various sources into your spreadsheets to take advantage of Excel’s research and visual features while dealing with XML-based data. The main advantage to importing XML data is to enable analyzing data from diverse sources in a user-friendly environment. In this article, we will discuss how to import XML data files into Excel in various ways, including using the Data tab, a web URL, the Developer tab with the Source and Import features, and importing multiple XML data files. XML data files will look similar to the image below after importing them into Excel.

Download Practice Workbook

Import XML.xlsx

What Is an XML Data File?

An XML (Extensible Markup Language) data file serves as a structured means of storing and organizing data. It’s a plain-text file format that employs a tag-based system, making it both human-readable and machine-readable. XML data files act as a universal language for data exchange that can communicate between different software systems and programming languages.

How to Import XML Data File into Excel: 3 Quick Methods

Clicking the Open option to open the .txt file

The data is already stored in XML format.

Sample text file containing XML data

Clicking Save As option from the File tab

Changing the file format to XML and hitting Save

As a result, we now have an XML data file. Let’s import it into our spreadsheet.

Sample data created by converting .txt documents into .xml

Method 1 – Using Data Tab

Clicking the From XML option from the Data tab

Selecting the XML file from the device storage

The Power Query window will open.

Clicking the book tab and hitting Load to option

Selecting a new location inside the worksheet to import data

We have successfully imported the XML data file into Excel.

Final result with importing XML data file into Excel

Clicking the Transform Data feature from the Navigator window

The Power Query Editor will open, where you can edit the data file to make changes to the data table.

Opening the Power Query Editor to edit the imported data

Method 2 – Using Web URL

While exploring multiple sites, you won’t be able to download the XML file directly. But you can import XML data using the URL link. Here, we will import XML data from Forbes.

STEPS:

Selecting the URL and copying it

Selecting From Web option by visiting the Developer tab

A From Web dialog box opens

Pasting the URL and hitting OK

Clicking Connect from the Access Web content window

Selecting the data from the left pane and hitting the Load option

We have successfully imported XML data into our spreadsheet.

Final result with importing XML data from URL

Method 3. Using Developer Tab

The Developer tab in Excel is primarily used for more advanced tasks related to Excel customization, automation, and macro development. We can use it to import XML data files using 2 different techniques.

3.1 – Using Source Option

Clicking the Source option from the Developer tab

Clicking the XML Maps from the right pane

Pressing the Add option from the <a href=XML Maps window" width="452" height="238" />

Selecting the XML file and hitting Open

The file is added in the XML Maps.

Clicking OK after adding the XML file

Dragging the XML file inside the spreadsheet

As a result, the table consisting of data will be inserted inside the worksheet.

Selecting the Pivot table and inserting XML file by pressing Import

Selecting the XML file and hitting Open

The XML data file is imported into the spreadsheet.

<a href=Final output with importing XML file inside the spreadsheet" width="531" height="344" />

3.2 Using Import Feature

We can import data directly utilizing the Import feature. The XML file will need to be added in the XML Maps window first.

STEPS:

<a href=Selecting the Import feature from the Developer tab" width="404" height="325" />

Choosing the XML file and hitting Import

The XML file is imported into Excel.

Final result with importing the XML file

How to Import Multiple XML Files into Excel

Similarly, we can also import multiple XML files into Excel. Suppose we have 2 XML files containing a Book List in a folder. Let’s import both files into a workbook.

Sample dataset with 2 XML files inside a folder

STEPS:

Clicking the Import option from the Developer tab

Holding SHIFT key and selecting both the XML file and hitting Import

Final result with importing multiple XML files into Excel

Things to Remember

Frequently Asked Questions

1. Can I customize the import process for XML data?

Yes, you can map XML elements to specific Excel columns, set data types, and configure refresh settings to keep the data up-to-date.

2. What should I do if the XML file has a complex structure or namespaces?

Complex XML structures or namespaces may require more advanced handling. Use Excel’s tools to manage namespaces and map elements to columns manually during the import process.

3. What if there are errors during the XML import process?

If errors occur during import, Excel will provide error messages that describe the issue. You may need to review the XML file’s structure, mapping, or data quality to address these errors.

Import XML to Excel: Knowledge Hub