Excel Open XML

What Is Excel Open XML File?

Excel Open XML is an option to convert an XML file to Excel. It enables importing XML data from external databases and programs into Excel, where the XML elements from an XML schema get mapped to the spreadsheet cells.

Users can use XML in Excel to access, manage, and transfer data, such as invoices or previous year’s revenue results reports, between Excel and other programs.

For example, the below image shows an XML file, Student_Grade_Final.xml, in Notepad. And it contains students’ names, grades, and promotion status details.

Excel Open XML - Example

To open and view XML in Excel, as shown above, we can import the XML data using the Get Data option from the Data tab.

Excel Open XML - Example - 1
  • The Get Data feature helps to select the required XML file, Student_Grade_Final.xml.
  • Then, it gives the option to load XML in Excel.
  • Also, the Workbook Queries pane on the right shows the table name used in the XML file from where the data gets imported.

Thus, we can view the given XML file data as an Excel table in a worksheet.

Key Takeaways
  • The Excel Open XML opens a file formatted as XML in Excel.
  • It enables us to import and export XML data to and from Excel. And as the XML schema gets mapped to the cells, we can manage XML data between Excel and other applications.
  • Users can use XML in a worksheet to conveniently access and manage data such as customer details in invoices between Excel and external databases.
  • We can convert Excel data into XML format using the Source and Export options in the Developer tab in Excel.
  • We can import XML data into Excel from the Developer tab using the Import option, the Data tab using the Get Data feature, and the web.

What Is XML File?

  • The XML, or the Extensible Markup Language file, enables one to manage and share structured information in an easy-to-read text format. And the file format adheres to industry standards and is compatible with different applications. The file format enables application experts to develop customized tags, schemas, and other XML elements.
  • An XML file works on a set of standard XML rules, and the below-shown rules help in mapping XML in Excel.
    • The first line in the XML file should be the following declaration.
      • <?xml version=”1.0″ encoding=”UTF-8” standalone=”yes”?>
      • While XML version 1.0 indicates the file adheres to XML standard, the UTF-8 encoding denotes that the file uses UTF-8 Unicode. And the standalone value, yes, indicates that the file does not require additional XML files for interpretation.
    • The next lines should contain the table name’s head, the columns’ values between the columns’ names, and the table name’s tail.
Excel Open XML - Table Name Code

Finally, loading the file containing the data in the above-defined structure in Excel will enable us to view XML in Excel.


Excel VBA – All in One Courses Bundle (35+ Hours of Video Tutorials)

If you want to learn Excel and VBA professionally, then ​Excel VBA All in One Courses Bundle​ (35+ hours) is the perfect solution. Whether you’re a beginner or an experienced user, this bundle covers it all – from Basic Excel to Advanced Excel, Macros, Power Query, and VBA.

Example Of Converting Excel Data To XML File Format

Consider we have the following data in a worksheet.

Example of Converting Excel Data to XML File Format

The steps to convert the given Excel data into XML file format are as follows:

  • Step 1: Enter the lines for the XML data’s schema in an empty Notepad file, as shown below.
Example of Converting Excel Data to XML File Format - Step 1
  • The first line will be the mandatory declaration. And in this illustration, we will not include the standalone value in the declaration as we do not require it.
  • The next line shows the object dataset, which indicates the data is in XML, and the schema included inline in the display is in the XML Schema Definition language.
  • Next, we provide the table name CustomerRecord head, following which we must provide the XML data’s schema for the row 2 information in the Excel data. And for that, we enter the columns’ headers, the first values in the specified columns from the Excel data, and the columns’ headers, followed by the table nametail.
  • Likewise, we enter the lines for the row 3 information in the Excel source data. Thus, we now have two samples, with the schema structure ending with the dataset tail.
  • Step 2: Click on FileSave As to save the file.
Example of Converting Excel Data to XML File Format - Step 2a

Name the file and save it with the .xml extension. Click Save to complete the action.

Example of Converting Excel Data to XML File Format - Step 2b
Example of Converting Excel Data to XML File Format - Step 2c

Next, we require to use the Developer tab options for the conversion. And if the ribbon does not show the Developer tab, as shown below.

Then, the steps to enable the tab in the ribbon are as follows:

  • Step 3: Click FileOptions to access the Excel Options window.
Example of Converting Excel Data to XML File Format - Step 3b
Example of Converting Excel Data to XML File Format - Step 3a
  • Step 4: Choose the Customize Ribbon tab, and check the Developer box from the Customize the Ribbon field.
Example of Converting Excel Data to XML File Format - Step 4a

And clicking OK will show the Developer tab in the ribbon.

Example of Converting Excel Data to XML File Format - Step 4b
  • Step 5: Click on Developer Source.
Example of Converting Excel Data to XML File Format - Step 5a

The XML Source pane opens, where we must click the XML Maps option.

Example of Converting Excel Data to XML File Format - Step 5b

The XML Maps window will open.

Example of Converting Excel Data to XML File Format - Step 5c
  • Step 6: Click Add in the XML Maps window.
Example of Converting Excel Data to XML File Format - Step 6a

The Select XML Source window will open, where we must select the required XML file to apply the XML schema to the Excel data.

Example of Converting Excel Data to XML File Format - Step 6b

Clicking Open will show a warning message stating that Excel will develop a schema based on the chosen XML source data. Click OK to proceed.

Example of Converting Excel Data to XML File Format - Step 6c

And click OK to continue with mapping XML in Excel.

Example of Converting Excel Data to XML File Format - Step 6d

Clicking OK will show the chosen XML map dataset_map in the XML Source pane.

Example of Converting Excel Data to XML File Format - Step 6e
  • Step 7: Click on the first column header in the CustomerRecord table in the XML Source window, and drag the cursor to the first column header in the Excel sheet.
Example of Converting Excel Data  - Step 7a

The chosen XML schema gets applied to the first column in the Excel data.

And repeat the process for the remaining three columns.

Example of Converting Excel Data - Step 7b

Thus, we obtain an Excel table enabled with all the XML schema features.

  • Step 8: Click DeveloperExport.
Example of Converting Excel Data - Step 8a

The Export XML window will open to enter the file name for the XML file.

Example of Converting Excel Data - Step 8b

Clicking Export will create an exported XML file.

Example of Converting Excel Data - Step 8c

Now, opening the exported XML will show the Excel data converted into the required XML file format.

Example of Converting Excel Data - Step 8d

Thus, using the XML data schema created for rows 2 and 3 Excel data, we can apply and extract the entire Excel data in the XML format.

Import XML Data Into Excel

We can import data in XML in Excel using the three methods, namely,

  1. Import From The Developer Tab.
  2. Import From The Data Tab.
  3. Import From The Web.

Let us see each method with an example.

The following image shows the contents of an XML file, Employee Record_Export.xml.

Import XML Data into Excel Example

Method #1 – Import From The Developer Tab

  • Step 1: Open an Excel file, and choose Developer Import.
Import from the Developer Tab - Step 1a

The Import XML window will open, where we must choose the XML file to import into Excel.

Import from the Developer Tab - Step 1b

On clicking Import, we will receive the below warning message stating that Excel will develop a schema based on the chosen XML source data. Click OK to proceed.

Import from the Developer Tab - Step 1c
  • Step 2: The Import Data window will open, where we must update the reference to the cell in the sheet where we require to view the imported XML data.
 Import from the Developer Tab - Step 2a

Finally, clicking OK will show the required XML data imported into the Excel sheet.

Import from the Developer Tab - Step 2b

Method #2 – Import From The Data Tab

  • Step 1: Open an Excel file, and choose DataGet Data From File From XML.
Import XML Data into Excel - Import from the Data Tab - Step 1a

The Import Data window opens, where we must select the required XML file to import.

Here, we shall use the XML file Employee Record_Export1.xml, which contains the same data as the original file, for the convenience of explaining the different importing methods.

Import from the Data Tab - Step 1b

On clicking Import, the Navigator window opens, where we must select the table name, EmployeeRecord, used in the XML file.

Import from the Data Tab - Step 1b
  • Step 2: Click Load to load XML in Excel.
Import from the Data Tab - Step 2a

And clicking Load will update a new Excel sheet with the imported XML file data.

Import from the Data Tab - Step 2b

[However, if the requirement is to edit XML in Excel, click Transform Data in the Navigator window.

 Import from the Data Tab - Step 2c

Clicking Transform Data will open the Power Query Editor, where we can edit and transform the imported XML data according to the requirement.

 Import from the Data Tab - Step 2d

Once completed with the editing, click the Close & Load option in the Home tab.

Import from the Data Tab - Step 2e

Furthermore, if the XML data to import into Excel is on the web. Then, we can use the third method.

Method #3 – Import From The Web

  • Step 1: Open an Excel file, and select the Data tab → Get Data feature → From Other Sources option → From Web option.
Import XML Data into Excel - Import from the Web - Step 1a

The window in the image below opens, where we must update the URL of the website containing the XML data to import. Assume the URL is the site index link of the Forbes website.

Import from the Web - Step 1b

Clicking OK will show the below warning message about accessing web content. Click Connect.

Import from the Web - Step 1c
  • Step 2: The Navigator window will open. Click the table name sitemap to preview the XML data to import into Excel.
Import from the Web - Step 2a

And clicking Load will complete the importing XML data from the web process. And we will achieve the result shown below.

Import from the Web - Step 2b

Moreover, we can also click Edit in the Navigator window to edit XML in Excel, as explained in the previous section.

Important Things To Note

  • Before opening the schema script of XML in Excel, ensure it contains the mandatory declaration. And follow the correct coding structure to apply the XML schema to the Excel data properly.
  • Ensure to include at least two schema samples for applying the same format to the entire worksheet data and export it as an XML file.

Frequently Asked Questions (FAQs)

1. Is XML same as XLSX?

XML is not the same as XLSX. However, there are no practical differences between the two data file formats.
XML is an Open-Source file format. On the other hand, XLSX is a proprietary Microsoft file format and is a group of XML files.
Viewing XML file data may require some parsing. An XLSX file shows data in a table format.

2. Can you convert XML to Excel?

We can convert XML to Excel by importing XML data into the worksheet using the following methods:
Importing XML data using the Import option from the Developer tab.
Here, importing XML data using the Get Data option from the Data tab.
Importing XML data from the web.

3. How to remove XML maps in Excel?

We can remove XML maps in Excel using the Delete option in the XML Maps window.

For example, a worksheet contains XML maps, dataset_Map, and dataset_Map1. And the requirement is to remove the XML maps in the Excel sheet.

The steps to remove XML maps in Excel are as follows:
• Step 1: Select Developer Source.

Excel Open XML - FAQ 3 - Step 1a

The XML Source pane opens, showing the currently chosen XML map, where we must click the XML Maps option.

Excel Open XML - FAQ 3 - Step 1b

The XML Maps window opens.

FAQ 3 - Step 1c

• Step 2: Select the first XML map, and click Delete in the XML Maps window.

Excel Open XML - FAQ 3 - Step 2a

Excel will show a warning message stating that deleting the XML map will no longer allow us to import and export XML data using the specific XML map. Click OK to continue.

FAQ 3 - Step 2b

Likewise, repeat the deletion process for the second XML map.

FAQ 3 - Step 2c

FAQ 3 - Step 2d

• Step 3: Click OK in the XML Maps window.

Excel Open XML - FAQ 3 - Step 3a

And we will see the XML Source window empty, as shown below.

FAQ 3 - Step 3b

4. Can’t open XML file in Excel?

We can’t open an XML file in Excel if the XML file does not refer to an XML schema.
Excel requires a schema based on the data in the XML file we wish to open in Excel. And an insufficient, incorrect, or missing schema can lead to the XML file in Excel not opening.

Download Template

This article must help understand the Excel Open XML, with its formula and examples. You can download the template here to use it instantly.

This has been a guide to Excel Open XML. Here we discuss how to convert, import data into XML (3 methods), remove XML maps with examples & downloadable template. You can learn more from the following articles –

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *