【发布时间】:2019-11-05 06:44:54
【问题描述】:
我需要一个代码来通过 python3(首选)或 bash 打开电子表格,我给他们密码并阅读它们。
我尝试通过 python-module "xlswriter"
我用这种方法保护 xlsx:
import xlsxwriter
workbook = xlsxwriter.Workbook('for-test-password.xlsx')
worksheet = workbook.add_worksheet()
content = (
['Gas', 10],
['Gasoline', 20],
['Potro', 30],
['Other',40],
)
row = 0
col = 0
for item, cost in (content):
worksheet.write(row, col, item)
worksheet.write(row, col + 1, cost)
row += 1
worksheet.protect('Passwd')
或尝试在 bash-script 中使用此代码
LibreOffice -p password -f xlsx for-test-password.xlsx
但这不会返回电子表格中的数据。
【问题讨论】:
-
发布你的代码,如果你尝试过的话。
-
我编辑问题并插入代码
-
问题的标题与问题的正文和示例完全不同。一个是关于读取/打开/解密 --- 而另一个是关于写入/保存/加密。
标签: python bash ubuntu spreadsheet libreoffice