tags:

views:

47

answers:

2

How to know the total number of columns used in an excel sheet in the following link http://scienceoss.com/read-excel-files-from-python/

Thanks..

+2  A: 

The Sheet class has a ncols member which indicates the number of columns

luc
Thanks got it...
Hulk
Great. Don't forget to accept :)
luc
i would have accepted it when i wrote the comment.But stackoverflow imposes some timimg constraints to accept the answer:)
Hulk
+2  A: 

Here are the first 6 lines in the "Quick Start" section of xlrd's README.html:

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

You can get a tutorial via this link. Likewise the latest SVN commit of the docs. If you installed xlrd from a source distribution or by running a Windows installer, you should already have the docs.

John Machin
Nice..........................
Hulk