用python读取带密码的excel文件中的数据


用python读取带密码的excel文件中的数据,程序代码如下:
 
#filename:readingxls.py
'''
此程序的作用为:用python读取带密码的excel文件中的数据。
首先通过pip安装xlrd第三方库 pip3 install xlrd
请输入excel文件路径:D:\x1.xls
'''
import xlrd
path=input("请输入excel文件路径:")
workbook=xlrd.open_workbook(path)
b=len(workbook.sheets())
i=0
for i in range(b):
    sheet=workbook.sheet_by_index(i)
    for row in range(sheet.nrows):
        print()
        for col in range(sheet.ncols):
            print("%7s"%sheet.row(row)[col].value,'\t',end='')
print()


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM