Python: Writing to Excel 2007+ files (.xlsx files)

前端 未结 7 1933
时光取名叫无心
时光取名叫无心 2020-12-09 11:22

Is there a Python module that writes Excel 2007+ files?
I\'m interested in writing a file longer than 65535 lines and only Excel 2007+ supports it.

相关标签:
7条回答
  • 2020-12-09 11:36

    Pyvot: http://packages.python.org/Pyvot/tutorial.html, although it is only for Excel 2010+

    0 讨论(0)
  • 2020-12-09 11:38

    So you want to write xlsx file, into my mind the Microsoft.office.excel.interop dll come to my mind, but not use it on a server.

    I know you can call dll from python : http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel(office.11).aspx

    0 讨论(0)
  • 2020-12-09 11:40

    Take a look at Eric' Gazoni's openpyxl project. The code can be found on bitbucket.

    0 讨论(0)
  • 2020-12-09 11:43

    If you are on Windows and have Excel 2007+ installed, you should be able to use pywin32 and COM to write XLSX files using almost the same code as you would would to write XLS files ... just change the "save as ...." part at the end.

    Probably, you can also write XLSX files using Excel 2003 with the freely downloadable add-on kit but the number of rows per sheet would be limited to 64K.

    0 讨论(0)
  • 2020-12-09 11:44

    You should take a look at xlsxcessive. It's for writing xlsx files, and is, perhaps, a bit more pythonic.

    0 讨论(0)
  • 2020-12-09 11:45

    There are two libraries you can take a look at.

    Python-xlsx and PyXLSX

    EDIT: As the comments mention, for writing you check out openpyxl

    0 讨论(0)
提交回复
热议问题