How to Convert XML to Columns In Excel: 4 Suitable Ways

Method 1 – Using XML from Local System

Steps:

  • Go to the Data tab and click on Get Data.
  • Select From File and then click on From XML.

convert xml to columns in excel

  • Select an XML file and click Import.

using local system to convert XML to columns in excel

  • In the Navigator window, select the XML data name and click Load.

  • Create Excel columns from the imported file.

using local system to convert XML to columns in excel


Method 2 – Fetching XML from Web

Steps:

  • Go to the Data tab and click From Web.

web url to convert XML to columns in excel

  • Paste the URL of the XML file and click OK.

web url to convert XML to columns in excel

  • Select the appropriate file path and click Connect.

  • Select the XML data name and click Load.

  • You should get the respective Excel columns.


Method 3 – Applying the FILTERXML Function

Steps:

  • Copy the XML file data and paste it into cell B4 of an Excel sheet.

filterxml function to convert XML to columns in excel

  • Go to a new sheet and insert this formula in cell B5:
=FILTERXML(FILTERXML!B5,"//PLANT/COMMON")

  • Press Enter, which should generate the Excel columns from the XML file.


Method 4 – Utilizing VBA Code

Steps:

  • Go to the Developer tab and select Visual Basic.

vba code to convert XML to columns in excel

  • Select Insert in the VBA window and click Module.

  • Type in the formula below in the new window:
Sub XML_to_Column()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim wBook As Workbook
With Workbooks.OpenXML("C:\Users\ASUS\Downloads\sitemap_index.xml" _
, , xlXmlLoadImportToList)
.SaveAs ("C:\Users\ASUS\Downloads\Salary_Sheet.xlsx")
.Close
End With
End Sub

  • Open the macro from the Developer tab by clicking on Macros.

  • In the Macro window, select the XML_to_Column macro and click Run.

  • The VBA code will create the columns inside cells B4 to C10.


How to Convert XML to CSV in Excel

Steps:

  • Click the File option in the top-left corner of the window.

How to Convert XML to CSV in Excel

  • Select Export and then click on Change File Type.

  • Select CSV under Other File Types and click Save As.

  • Give a name to the file and click Save.

  • This will generate the CSV file which you can open with Notepad or any other text editor.


How to Convert XML to Excel Table

Steps:

  • Navigate to the Data tab and select Get Data.
  • Click From XML under From File.

How to Convert XML to Excel Table

  • Select the XML file and click Import.

  • Select the XML data name and click Load To.

  • In the Import Data window, select Table and click OK.

  • This will convert the XML file into an Excel table.


Download Practice Workbook

You can download the practice workbook from here.


Related Articles

<< Go Back to Import XML to Excel | Importing Data in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Nazmul Hossain Shovon
Nazmul Hossain Shovon

Nazmul Hossain Shovon, a BUET graduate in Naval Architecture and Marine Engineering, embarked on his career with 8 months dedicated to the Exceldemy project's triumph. Transitioning into a Software Developer role, he specialized in web add-in development. At Exceldemy, he authored about 125 blog articles and solved many visitors’ problems, refining his writing skills and delving into Excel-related topics. With a primary passion for programming and software development, Shovon continually explores new horizons, fostering professional growth in his... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo