Import data from Excel

Mirco Wahab at
Tue May 9 09:44:19 CEST 2006


> Is it possible to import data from Excel for 
> doing numerical analysis in Python? If so how? 

use John Machins glamouros 'xlrd'

form his documentation:

  import xlrd
    book = xlrd.open_workbook("myfile.xls")
    print "The number of worksheets is", book.nsheets
    print "Worksheet name(s):", book.sheet_names()
    sh = book.sheet_by_index(0)
    print, sh.nrows, sh.ncols
    print "Cell D30 is", sh.cell_value(rowx=29, colx=3)
    for rx in range(sh.nrows):
        print sh.row(rx)

This module is (imho) quite useful. No
need for installed Windows or Office.



More information about the Python-list mailing list