#导入模块
import xlrd
#读取excel文件
def read_excel():
workbook = xlrd.open_workbook('data.xls')
# workbook.sheet() #获取所有工作簿的表
nameList = workbook.sheet_names()#获取所有表名
print(nameList)
tableone = workbook.sheet_by_name(nameList[0])
rows = tableone.nrows #行
cols = tableone.ncols #列
for i in range(0,rows):#遍历行
row_value = tableone.row_values(i)#行内容
print(row_value)
for i in range(0,cols):#遍历列
col_value = tableone.col_values(i)#列内容
print(col_value)
#获取具体单元格的内容,第几行,第几列(从0开始)
cell_value = tableone.cell_value(1,1)
print(cell_value)
read_excel()