简体   繁体   English

xlrd错误:工作簿文件已加密

[英]xlrd error: Workbook file is encrypted

Python says xls file is encrypted but I can open it on windows. Python说xls文件是加密的,但是我可以在Windows上打开它。 What is the problem? 问题是什么?

from xlrd import * from xlwt import * f = open_workbook('test.xls')

you can use the com.client instead of the xlrd module which can not handle the encrypted excel, just like this 您可以使用com.client代替无法处理加密excel的xlrd模块,就像这样

import win32com.client
excel = win32com.client.Dispatch('Excel.Application')
workbook = excel.Workbooks.open('test.xls')
sheet = workbook.WorkSheets('sheet name')
## get the cell value
row,col = 1,1
sheet.Cells(row,col).value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM