Importing xml file in MS Excel - How can we automate this flow using Python or any other programming language?

Viewed 281

I want to automate the process of importing XML file data in MS Excel using Python or any other programming language or by any other method which is possible. How can I achieve that?

2 Answers

The Python programming languages pandas library can facilitate in this. Once you get the XML into a DataFrame, there's a method that facilitates saving the DataFrame to Excel format (or at least CSV).

This is a comprehensive guide on XML to Excel conversion in Python here

If you want to do this in Java, the Apache POI library is very useful. A short guide is available here

There's quite a few ways to get this done, depending on the language used.

The solution to your problem is mentioned in the steps below:

  • Imports required library
  • read and parse XML file from the path
  • extract the root element
  • make a map after finding the required elements from the root elements
  • create Excel file from the created map object
  • save that file to the destined path
  • close all the stream if any remain opened.

Now code the above steps in any prefer language python, java, or any other.

Related