4

I need to create Excel XML files from Python.

The Excel XML format is fairly simple. I looked at a a sample xml file saved from Excel 2003 and it is fairly simple.

I'm looking for a a Pythonic, ready made library to create such xml files instead of reinventing one.

Something that I can use as below:

book = Expy.Workbook()
s1 = book.add_sheet()
s1[0, 2] = "A3"
s1[0, 0] = 12
s1[0, 9] = Expy.Formula("=Sum(A1:A3)")

book.write("excelfile.xml")

Anybody know of something like that?

xlwt seems outdated, supporting python 2.x only, and seems to write xls files, not xml.

1
  • 1
    Be aware that the XML generated by Excel 2003 is totally different from the Open XML (xlsx) files from Excel 2007/2010 Commented Jul 27, 2010 at 16:43

3 Answers 3

3

give pythonOffice a try

Sign up to request clarification or add additional context in comments.

1 Comment

Looks promising. But seems a bit outdated.
1

If you are on windows with Excel installed, you could look into Excel Automation.

from win32com import client
excel_app = client.Dispatch("Excel.Application")
# check VBA documentation on automating excel...

1 Comment

Good idea, but I may not have Excel installed.
1

xlwt will write Excel files from python, but I'm not sure if it handles the newer XML file formats. http://pypi.python.org/pypi/xlwt

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.