python自动移除excel文件密码(小工具)

安装 msoffcrypto-tool

使用pip命令安装: 打开命令行工具(如终端、命令提示符或Powershell),然后输入以下命令来安装msoffcrypto-tool:
pip install msoffcrypto-tool库,进行自动移除excel文件密码

python 复制代码
import msoffcrypto

# 已加密Excel文件路径
encrypted_file = "F:\解密前.xlsx"
# 未加密文件将保存的路径
unencrypted_file = "F:\解密后.xlsx"
# Excel文件密码
excel_password = "密码"

# 打开加密文件
with open(encrypted_file, "rb") as encrypted_file_fd:
    office_file = msoffcrypto.OfficeFile(encrypted_file_fd)

    # 使用密码解密
    office_file.load_key(password=excel_password)

    # 将解密内容写入新文件
    with open(unencrypted_file, "wb") as unencrypted_file_fd:
        office_file.decrypt(unencrypted_file_fd)

print(f"文件已解密并保存至:{unencrypted_file}")
相关推荐
编码者卢布26 分钟前
【Azure APIM】APIM的诊断日志与Application Insights的日志是否可以串联为一个端到端的日志链路呢?
python·flask·azure
weixin_3077791339 分钟前
Linux下Jenkins数据故障的系统化排查Shell脚本
linux·运维·服务器·jenkins
荒--1 小时前
Burp Suite(二)
linux·运维·服务器
FriendshipT1 小时前
Ultralytics:解读CBLinear模块
人工智能·pytorch·python·深度学习·目标检测
AI开发发烧友1 小时前
LangGraph多Agent协作实战:以物流售前场景为例的5 Agent工作流设计
python
码云骑士1 小时前
70-多Agent协作-CrewAI-AutoGen-角色分工与信息传递协议
python
小白还菜2 小时前
linux(Debian)使用mdadm组磁盘RAID1阵列
linux·运维
Hachi被抢先注册了2 小时前
Skills总结
python
用户0332126663672 小时前
使用 Python 在 PowerPoint 中创建折线图和条形图
python
benchmark_cc2 小时前
如何用 Python 进行多周期 K 线合成与时区对齐?基于 QuantDash 与 Pandas 的量化数据清洗实战(附 GitHub 源码)
开发语言·python·github·盯盘·pandas·quantdash·量化数据