Python的第三方库xlrd在Pypi上的地址:https://pypi.org/project/xlrd/
xlrd是一个用于读取xls格式的Excel文件的Python库,当前版本为2.0.1,xlrd在Poetry下的安装命令为:
poetry add xlrd
最简洁的xls格式的Excel文件的读取示例:
import xlrd
wb=xlrd.open_workbook("E:\\测试文件.xls")
# 2.获取sheet表格的数量
print(wb.nsheets)
# 3.获取所有sheet表格的名称
print(wb.sheet_names())
# 4.获取第一个sheet
sheet=wb.sheet_by_index(0)
# 5.获取指定sheet的名称、行数、列数
print("{0} {1} {2}".format(sheet.name, shee