diff options
Diffstat (limited to 'python/xmltotab.py')
| -rw-r--r-- | python/xmltotab.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/python/xmltotab.py b/python/xmltotab.py new file mode 100644 index 00000000..ba8b2921 --- /dev/null +++ b/python/xmltotab.py @@ -0,0 +1,14 @@ +from lxml import etree +import csv + +ns = '{urn:schemas-microsoft-com:office:spreadsheet}' + +doc = etree.parse('/home/share/guillaume/grid1_1cz1rlvt.xml') +tree = doc.getroot() + +with open("output.csv", "w") as fh: + csvwriter = csv.writer(fh) + for row in tree.findall(".//{0}Row".format(ns)): + csvwriter.writerow([cell.findtext('{0}Data'.format(ns)) for cell in row]) + + |
