openpyxl: simple writer done
by Eric Gazoni
I’ve been very busy on openpyxl the last few days, and I managed to get a working writer for basic data types (strings, numerics).
For the impatient, you can clone my bitbucket repository:
It’s still a work in progress, so expect some quirks here and there, and if that happens, please file a new issue here.
If you like it, you can also drop a comment below or send me an email (see Contact page).
Usage is pretty simple as you can see:
from openpyxl.workbook import Workbook from openpyxl.writer.excel import ExcelWriter from openpyxl.cell import get_column_letter wb = Workbook() ew = ExcelWriter(workbook = wb) dest_filename = r'empty_book.xlsx' ws = wb.worksheets ws.title = "range names" for col_idx in xrange(1, 40): col = get_column_letter(col_idx) for row in xrange(1, 600): ws.cell('%s%s'%(col, row)).value = '%s%s' % (col, row) ws = wb.create_sheet() ws.title = 'Pi' ws.cell('F5').value = 3.14 ew.save(filename = dest_filename)
Next features are:
- a working reader (so that I can read back files generated by the writer)
- dates support