in Open Source

.xls* to XML – Python Library

I was recently working on a project which among the requirements had a feature request for exporting a variety of Excel based formats to XML. Although Microsoft Excel has a built in functionality to export the data to XML, it is generally to complex and has more data than an average Joe would require.

The code was in Python so I started digging for a quick solution for my problem but, to my surprise I couldn’t find a single working script which would do this for me. Either the libraries didn’t work at all or they supported only specific versions of Excel or even worse, not all Excel formats worked properly.

I ended up writing the code by myself and decided to open source it. The script will scan for all the supported files within its root folder and convert them all. XML files will be saved into a folder named XML which the script also creates. Every row within excel will be saved as a separate XML (one row for header and one for content). XML will be saved as a prettified output (you can modify the script if you need compressed). Script works for any number of sheets, number of columns and rows. It can be found on the following link:

Any improvements to the script, bug fixes or feature additions are more than welcome. Fork the code, and submit a pull request, I will do my best to review it in shortest possible time. You can also open an issue if you have any questions or problems.

  • Damir Čengić

    Very nice!