xlrd Python库读取.xls格式Excel文件

xlrd读取.xls格式Excel文件

xlrd,Python第三方库,可以用于读取历史.xls格式的Excel文件中的数据和格式化信息。据Github的内容介绍,此库将不再读取除.xls文件以外的任何文件。

xlrd应用实例

import xlrd
book = xlrd.open_workbook("myfile.xls")
print("The number of worksheets is {0}".format(book.nsheets))
print("Worksheet name(s): {0}".format(book.sheet_names()))
sh = book.sheet_by_index(0)
print("{0} {1} {2}".format(sh.name, sh.nrows, sh.ncols))
print("Cell D30 is {0}".format(sh.cell_value(rowx=29, colx=3)))
for rx in range(sh.nrows):
    print(sh.row(rx))

xlrd开源协议和Github stars

BSD licence(来源pypi)

Github 2.1k stars

xlrd安装命令

pip install xlrd

Python版本要求

Requires: Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*(来源pypi)

免责声明:内容编辑自网络,仅供参考,不保证正确性,不作任何决策依据!!以上数据皆截止于博文的写稿日期。


行业导航 / Python指南 :
























Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.