Import data from Excel

Mirco Wahab peace.is.our.profession at gmx.de
Tue May 9 03:44:19 EDT 2006


Hi,

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

use John Machins glamouros 'xlrd'
http://www.lexicon.net/sjmachin/xlrd.htm

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.name, 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.

Regards

Mirco



More information about the Python-list mailing list