Check Password to modify using Aspose.Cells with Golang via C++
Contents
[
Hide
]
Sometimes, you need to check if the given password matches the Password to modify programmatically. Aspose.Cells provides the
WorkbookSettings.WriteProtection.ValidatePassword() method, which you can use to check if the given Password to modify is correct or not.
Check Password to modify in Microsoft Excel
You can assign Password to open and Password to modify while creating your workbooks in Microsoft Excel. Please see this screenshot showing the interface Microsoft Excel provides to specify these passwords.
![]() |
|---|
Check Password to modify using Aspose.Cells
The following sample code loads the source Excel file, which has a Password to open of 1234 and a Password to modify of 5678. The code first checks whether 567 is the correct Password to modify (returns false) and then checks whether 5678 is the Password to modify (returns true).
Console Output
Here is the console output of the above sample code after loading the source Excel file.
Is 567 correct Password to modify: False
Is 5678 correct Password to modify: True