Is there a simple (free) way to encrypt an excel workbook in python?

Viewed 171

I need to automate sending of a number of Excel Workbooks but have slight concerns about security. I would like to password protect each workbook before they are delivered. This encryption process would need to occur in python

Is there a simple way of doing it? I've come across Openpyxl, however, the password protection doesn't seem to work fully. i.e. no password is required on opening.

from openpyxl import Workbook
from openpyxl import load_workbook

test_spreadsheet = "test.xlsx"

wb = Workbook()
wb.security.workbookPassword = 'password'
wb.security.lockStructure = True
wb.save(test_spreadsheet)
0 Answers
Related