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

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)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source