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}")
相关推荐
梦幻精灵_cq16 小时前
《双征color》诗解——梦幻精灵_cq对终端渲染的数据结构设计模型式拓展
数据结构·python
天才奇男子16 小时前
LVS原理及部署
linux·运维·云原生·wpf·lvs·linux chrony
喵手16 小时前
Python爬虫零基础入门【第八章:项目实战演练·第3节】上线与运维入门:定时运行、日志轮转、失败告警(轻量版)!
爬虫·python·爬虫实战·python爬虫工程化实战·零基础python爬虫教学·定时运行·日志轮转
梁洪飞16 小时前
内核启动卡死在Starting kernel ...,没有任何打印如何定位
linux·arm开发·嵌入式硬件·arm
骆驼爱记录17 小时前
Excel数据源到Word成绩单自动生成
自动化·word·excel·wps·新人首发
321.。17 小时前
深入理解 Linux 线程封装:从 pthread 到 C++ 面向对象实现
linux·开发语言·c++
EmbedLinX17 小时前
Linux内核之文件系统:从VFS到实际存储的运作机制
linux·服务器·c语言·c++
weixin_6600967817 小时前
flash-attention总是安装失败
python·flash-attention
实心儿儿17 小时前
Linux —— 进程概念 - 初识进程
linux·运维·服务器
yaoxin52112317 小时前
303. Java Stream API - 查找元素
java·windows·python