[python-win32] Documentation for win32com for Worksheets Worksheets.Range and Worksheets.Cells

Waldemar Osuch waldemar.osuch at gmail.com
Thu Jan 28 21:03:42 CET 2010


What Tim said but if you are generating Excel files from
scratch consider using xlwt:
http://pypi.python.org/pypi/xlwt

The advantage is that the module is cross platform and you do
not need to have Excel installed.  In my experience it is also
quicker to generate spreadsheets


import xlwt

values = list('Witamy %s' % i for i in range(100))

hst = xlwt.easyxf('font: bold on, height 260;')

book = xlwt.Workbook(encoding='cp1252')
sh = book.add_sheet('hello')

sh.write(0, 0, 'Heading', hst)
for rx, val in enumerate(values, 1):
    sh.write(rx, 0, val)

# do the freeze
sh.panes_frozen = True
sh.horz_split_pos = 1
sh.remove_splits = True

book.save('hello.xls')


Waldemar


More information about the python-win32 mailing list