Script for converting tabular data in Excel spreadsheets into simple XML
Switch branches/tags
Nothing to show
Clone or download
antun Merge pull request #2 from dimosr7/encoding-fix
UTF-8 encoding issues fix
Latest commit 1a36026 Feb 11, 2015
Failed to load latest commit information.
test Added options for subnodes vs attributes, root node. Separated the te… Sep 20, 2012


Script for converting tabular data in Excel spreadsheets into simple XML


./ test/people.xls

... and that will output to STDOUT:

<node ID="1" First_Name="Homer" Last_Name="Simpson" Phone="1-312-118-0853" />
<node ID="2" First_Name="Wilma" Last_Name="Flintstone" Phone="1-961-423-3877" />
<node ID="3" First_Name="Danger" Last_Name="Mouse" Phone="1-244-683-1796" />
<node ID="4" First_Name="Astro" Last_Name="Boy" Phone="1-439-944-5821" />


  • There are options to output cells (columns) as nodes instead of attributes, to specify the name of the nodes themselves, to add a root node. Just run -h

  • This uses the Python xlrd library, for interacting with Excel files. ( That library is bundled here, in the "library" directory, to make it easy for people to install.

  • You can put the whole directory in a directory in your path (e.g. ~/bin). Make sure that you leave the library directory in place.

  • There are two spreadsheets for testing in the "test" directory.

  • You should set your PYTHONIOENCODING environment variable to utf-8, to avoid problems with piping unicode characters from stdout e.g. export PYTHONIOENCODING=utf-8 Otherwise you may run into errors such as: UnicodeEncodeError: 'ascii' codec can't encode characters in position