This is a simple phyton script to create a plist xml file from a excel sheet. The values from the first row are used as keys for the plist. All values are converted to string.
To read the excel sheet, i use the xlrd package.
import xlrd
from xml.dom.minidom import Document
wb = xlrd.open_workbook('Test.xls')
sh = wb.sheet_by_index(0)
doc = Document()
plist = doc.createElement("plist")
plist.setAttribute("version","1.0")
doc.appendChild(plist)
array = doc.createElement("array")
plist.appendChild(array)
for rownum in range(sh.nrows):
if rownum > 0:
dict = doc.createElement("dict")
array.appendChild(dict)
for cellnum in range(sh.ncols):
key = doc.createElement("key")
key.appendChild(doc.createTextNode(sh.cell_value(0,cellnum)))
dict.appendChild(key)
value = doc.createElement("string")
value.appendChild(doc.createTextNode(unicode(sh.cell_value(rownum,cellnum))))
dict.appendChild(value)
out = open("Test.xml", "w")
out.write(doc.toxml("utf-8"))
out.close()
