用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