import xlrd
book = xlrd.open_workbook('CJ_test.xls')
sheet = book.sheet_by_index(0)
print(sheet.row_values(0)) # 某一行的資料
print(sheet.col_values(0)) # 某一列的資料
print(sheet.cell(0, 0).value) # 某個單元格的資料
print(sheet.cell(1, 2).value) # 某個單元格的資料
print(sheet.nrows) # 總共有多少行
print(sheet.ncols) # 總共有多少列
# 整行的資料
# 整列的資料
# 某個單元格
# sheet = book.sheet_by_name()
for i in range(sheet.nrows):
print(sheet.row_values(i))
轉載于:https://www.cnblogs.com/skyxiuli/p/10858945.html