qax-os / excelize

Go language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
https://xuri.me/excelize
BSD 3-Clause "New" or "Revised" License
17.62k stars 1.68k forks source link

Password protected sheet or range #1891

Closed FranLegon closed 2 months ago

FranLegon commented 2 months ago

Excel allows for the protection of sheets and even specific ranges using a password: image image Can this feature be implemented into excelize? Thanks in advance!

Note: #199 refers to password-protecting an entire xlsx file and that issue has been solved.

xuri commented 2 months ago

Thanks for your issue. Please reference the documentation of the ProtectSheet function. For example:

err := f.ProtectSheet("Sheet1", &excelize.SheetProtectionOptions{
    Password:            "password",
    SelectUnlockedCells: true,
    SelectLockedCells:   true,
})

Also reference the related issues #736 and #1511. I've closed this issue, if you have any questions, please let me know, and you can reopen this anytime.

FranLegon commented 2 months ago

Thanks a lot! Sorry about the unnecessary request. Great work btw.