[Solved]: XML File Not Opening in Excel (3 Suitable Solutions)

The Extensible Markup Language is known as XML. This dialect is comparable to HTML. A markup language really employs tags to define text and is a type of computer language. While showing the text is not predefined, tags are utilized to format it. This implies that the writer of the file defines the tags that are utilized to create the XML file. In other words, a text-based document with an.xml extension is what an XML file actually is. You can tell that a file is an XML file by looking for the .xml file extension. In this article, we will discuss 2 suitable solutions if an XML file is not opening in Excel.


Download Practice Workbook

You may download the following Excel workbook for better understanding and practice it by yourself.


3 Suitable Solutions If XML File Is Not Opening in Excel

You might occasionally need to work with the data in an XML file because it is a widely used file format on the internet. Since the XML file isn’t intended for human reading, you can’t use it directly on machines. You will learn how to solve to open an XML file in Excel if it is not opened by using the Data tab, VBA Code, and a default method, so you can quickly manipulate and analyze the data.


1. Utilizing Data Tab For Opening XML File by Exporting into Excel

This first step will demonstrate how to access an XML file in Excel using the Data Tab. From the Data tab, we will use the Get Data command to export our XML file into Excel. Hence, it will automatically change the property of the XML extension.

Steps:

  • Firstly, go to the Data tab.
  • Secondly, click on the Get Data command.
  • Thirdly, select the From File option.
  • Finally, choose the From XML option to import the data from the XML file.

Utilizing Data Tab to solve if XML is not Opening on Excel

  • Here, we put our XML file as xml in the Local Disc (C:).
  • Now, click on the Local Disc (C:).
  • Then, select the XML file named xml.
  • Finally, click on Import.

  • In this part, the Navigator panel will open.
  • And, you can see the preview of the data set on the left by clicking the book option on the left side which we have marked by 1.
  • Then, click on the Load option, which is marked by 2, to load your XML data into Excel.

Read More: How to Open XML File in Excel for Income Tax (2 Easy Ways)


2. Applying VBA Code to Open XML File If Not Opening in Excel

VBA is a programming language that we may use for a variety of tasks. Using the Alt + F11 keyboard shortcut, you can launch the VBA editor. In the last section, we will generate a VBA code that makes it very easy to solve if an XML file is not opening in Excel.

Steps:

  • Firstly, we will open the Developer tab.
  • Then, we will select the Visual Basic command.

Applying VBA Code to Solve if XML is not Opening in Excel

  • Here, the Visual Basic window will open.
  • After that, from the Insert option, we will choose the new Module to write a VBA code.

  • Now, paste the following VBA code into the Module
  • Besides, to run the program, click the “Run” button or press F5.
Sub Solve_NotOpening_XML_File()
'Declaring Variables
Dim XMLFilePath As String
Dim WBook As Workbook
' Disabling the screen updating
Application.ScreenUpdating = False
'Does not display any alerts or messages
Application.DisplayAlerts = False
'Calling the location of the XML file
XMLFilePath = "C:\OrderDetails.xml"
'Creating a new workbook and loads an XML file into it
Set WBook = Workbooks.OpenXML(Filename:=XMLFilePath, LoadOption:=xlXmlLoadImportToList)
'Display alerts or messages
Application.DisplayAlerts = True
'Enabling the screen updating
Application.ScreenUpdating = True
End Sub 
			

VBA Code Breakdown

  • Firstly, we will specify our Sub Procedure Sub Open_XML_File().
  • Then, we declare variables using Dim XMLFilePath As String and Dim WBook As Workbook
  • Now we will call the location of the XML file using XMLFilePath = “C:\OrderDetails.xml”.
  • Finally, we will specify the new workbook to open the XML file in Excel Set WBook = Workbooks.OpenXML(Filename:=XMLFilePath, LoadOption:=xlXmlLoadImportToList).\
  • Finally, by using the VBA code, the given image demonstrates the results of solving the XML file if it is not opening in Excel.

Applying VBA Code to Solve if XML is not Opening in Excel

Read More: How to Extract Data from XML File to Excel (2 Easy Ways)


Similar Readings


3. Opening XML File in Excel by Changing Properties

In this section, we will show you a default method to solve if an XML file is not opening in Excel. We will change the property of the XML file into an Excel file. After that, we will utilize the Program Files menu to do the rest.

Steps:

  • Firstly, right-click on the XML file.
  • Secondly, go to the Properties option.

Opening XML File in Excel by Default if XML is Opening in Excel

  • Then, click on the Change option.

  • Here, select Look for another app on this pc option and click on it.

  • After that, go to the Local Disc (C:).
  • Then, select the Program Files option.

  • Here, click on the Microsoft Office option.

  • Besides, go to the root option.

  • Then, choose Office 16 option.

  • Here, select the EXCEL.EXE option.
  • So, click on the Open.

  • Finally, by using the default method, the given image shows the results of solving the XML file if it is not opening in Excel.

Opening XML File in Excel by Default if XML is Opening in Excel

Read More: Difference Between XML and Excel Files (9 Real Instances)


Conclusion

In this article, we’ve covered 3 Suitable Solutions If XML File Is Not Opening in Excel. We sincerely hope you enjoyed and learned a lot from this article. Additionally, if you want to read more articles on Excel, you may visit our website, Exceldemy. If you have any questions, comments, or recommendations, kindly leave them in the comment section below.


Related Articles

Bishawajit Chakraborty

Bishawajit Chakraborty

I'm Bishawajit Chakraborty. Hello. I graduated from Rajshahi University of Engineering & Technology (RUET) with a degree in Mechanical Engineering. I'm working with ExcelDemy as a Content Developer for Excel & VBA. You can visit our website, Exceldemy if you'd like to read my published articles on MS Excel and VBA.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo