[GH-ISSUE #516] Workbook protection #515

Closed
opened 2026-10-02 23:11:46 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @Clements-Peter on GitHub (Jun 5, 2026).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/516

Hi,
First of all, thank you very much for the nice work !

I was wondering, as "worksheet protection" is in place, if it would be possible to implement the "workbook protection".
At the moment I use openpyxl for that, and it would be nicer if this could be replaced completely by xlsxwriter.

Looking forward to the implementation,
Thanks again,

Peter

Originally created by @Clements-Peter on GitHub (Jun 5, 2026). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/516 Hi, First of all, thank you very much for the nice work ! I was wondering, as "worksheet protection" is in place, if it would be possible to implement the "workbook protection". At the moment I use openpyxl for that, and it would be nicer if this could be replaced completely by xlsxwriter. Looking forward to the implementation, Thanks again, Peter
Author
Owner

@jmcnamara commented on GitHub (Jun 5, 2026):

I don't intent to add "workbook protection" for libxlsxwriter/xlsxwriter. Here is the usual FAQ and recommendation to use msoffice-crypt:

Q. Can I password protect an XlsxWriter xlsx file

Although it is possible to password protect a worksheet using the Worksheet
protect method it isn't possible to password protect the entire
workbook/file using XlsxWriter.

The reason for this is that a protected/encrypted xlsx file is in a different
format from an ordinary xlsx file. This would require a lot of additional work,
and testing, and isn't something that is on the XlsxWriter roadmap.

However, it is possible to password protect an XlsxWriter generated file using
a third party open source tool called msoffice-crypt. This works for macOS, Linux and Windows:

msoffice-crypt.exe -e -p password clear.xlsx encrypted.xlsx
<!-- gh-comment-id:4630835351 --> @jmcnamara commented on GitHub (Jun 5, 2026): I don't intent to add "workbook protection" for libxlsxwriter/xlsxwriter. Here is the usual [FAQ and recommendation](https://xlsxwriter.readthedocs.io/faq.html#q-can-i-password-protect-an-xlsxwriter-xlsx-file) to use `msoffice-crypt`: # Q. Can I password protect an XlsxWriter xlsx file Although it is possible to password protect a worksheet using the Worksheet `protect` method it isn't possible to password protect the entire workbook/file using XlsxWriter. The reason for this is that a protected/encrypted xlsx file is in a different format from an ordinary xlsx file. This would require a lot of additional work, and testing, and isn't something that is on the XlsxWriter roadmap. However, it is possible to password protect an XlsxWriter generated file using a third party open source tool called [msoffice-crypt](https://github.com/herumi/msoffice). This works for macOS, Linux and Windows: msoffice-crypt.exe -e -p password clear.xlsx encrypted.xlsx
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github-starred/libxlsxwriter#515
No description provided.