Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 202
Jonathan Livni Avatar asked Nov 23 '10 15:11

Jonathan Livni


People also ask

Can Excel 2007 Open XLSX files?

To open XLSX files in Excel, simply double click on the file. If you have a compatible version of Excel installed on your computer (i.e. 2007 or higher), the file will automatically open.

How do you write to an Excel file using Python?

Write Excel File Using openpyxl Module xlsx, xlsm, xltx, and xltm files. You can check it by running type(wb). The load_workbook() function takes an argument and returns a workbook object, which represents the file. Make sure that you are in the same directory where your spreadsheet is located.


3 Answers

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

like image 179
Mark Baker Avatar answered Oct 22 '22 11:10

Mark Baker


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

like image 10
user225312 Avatar answered Oct 22 '22 11:10

user225312


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

like image 8
chmullig Avatar answered Oct 22 '22 10:10

chmullig