pandas打开加密的excel
import pandas as pd
import os
import io
import datetime
file_temp = io.BytesIO()
with open(io, "rb") as f:
file = msoffcrypto.OfficeFile(f)
file.load_key(password)
file.decrypt(file_temp)
#file.decrypt(open(path_new, 'wb'))
df = pd.read_excel(io=file_temp,sheet_name='每日数据',dtype='object')
print(df.head())
参考:
python - Pandas 如何读取加密的excel - SegmentFault 思否
使用Pandas读取加密的Excel文件-腾讯云开发者社区-腾讯云