Transform a spreadsheet into a localization xml file using python

Some time ago a customer at my work provided descriptions of some sort of article codes in the form of a spreadsheet. We needed to transform the information into a localization file in xml format. I don't really remember how I did this at that time. I believe I used some text editor and did some string replacements. I figured it would be a one time thing, so why automate. Now, last week a colleague started working on a new project for this client and it turns out he needs to build again new localization files.

So I figured a script that would automate the transformation would be nice to have, fun to write and good practice.

First we need to export the spreadsheet as a csv file (UTF-8 encoded) and call it input.csv. I use LibreOffice to do this.
Export the spreadsheet to csv file UTF-8 encoded

We will run the python script from the same directory as the input file.
This will result in the output.xml file.


Popular post

Which Forex Pairs are Generally Trending and Which Ones Tend to Revert to the Mean

Build more wealth with gold

Get links to data referenced by