import xlrd
# 打开表
data = xlrd.open_workbook('D:\pycharm\\rename\data.xlsx')
# 指定sheet
# tabel = data.sheet_by_name(u'data')
tabel = data.sheet_by_index(0)
print(tabel.name) #sheet名
print(tabel.ncols) # 列数
print(tabel.nrows) # 行数
# 指定单元格取值
cell_A1 = tabel.cell(0,2).value
print(cell_A1)
# 指定行取值
row_2 = tabel.row_values(2)
print(row_2)
# 指定列取值
col_2 = tabel.col_values(1)
print(col_2)
浙公网安备 33010602011771号