Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I actually prefer to work with xlrd if I need to muck about with excel spreadsheets. It's also much easier to use than the COM API from win32com.

xlrd Pros:

  • Fully documented
  • Lots of examples
  • You don't need a PSSE license

xlrd Cons:

  • It's an extra package you have to install.

I know this isn't a direct answer to your question. I went to grab an excelpy example from my scripts, but I realized I am not using it because of the other tools available. If memory serves, I tried once and decided to stick with xlrd/xlwt.

I actually prefer to work with xlrd if I need to muck about with excel spreadsheets. It's also much easier to use than the COM API from win32com.

xlrd Pros:

  • Fully documented
  • Lots of examples
  • You don't need a PSSE license

xlrd Cons:

  • It's an extra package you have to install.

I know this isn't a direct answer to your question. I went to grab an excelpy example from my scripts, but I realized I am not using it because of the other tools available. If memory serves, I tried once and decided to stick with xlrd/xlwt.

xlrd/xlwt. There is also openpyxl. It looks like a nice package, but I haven't tried it yet.

xlrd Example

Here's an example of workbook navigation from the docs::

from xlrd import open_workbook
wb = open_workbook('simple.xls')
for s in wb.sheets():
    print 'Sheet:',s.name
    for row in range(s.nrows):
        values = []
        for col in range(s.ncols):
            values.append(s.cell(row,col).value)
        print ','.join(values)
    print