python xlrd简单读取excel

 1 import xlrd
 2 #打开文件
 3 book = xlrd.open_workbook ('Status.xlsx')
 4 #获取数据表
 5 table1 = book.sheets()[0]
 6 table2 = book.sheets()[1]
 7 #读取行数据和列数据
 8 col_0 = table1.col_values(0)
 9 row_0 = table1.row_values(0)
10 #读取数据表长度和宽度
11 row_len = table1.nrows
12 col_len = table1.ncols
13 
14 print len(book.sheets())
15 print (row_len, col_len)

 

posted @ 2018-04-03 05:07  Matrix_R  阅读(283)  评论(0编辑  收藏  举报