Sometimes, when presenting Excel files, it would be appropriate to protect/lock certain features in place. For example, you might like to prevent future users from adding, deleting, moving, renaming, hiding sheets or unhiding hidden sheets. In these cases, you can set a password, which a user must enter correctly before they are able to perform such features.
You can also use this step "unprotect" a workbook, if the input file already has a password set, and a correct password is required before any changes can be made to the file.
Note: do not confuse this step with the "Alter workbook security" instruction which requires any future user to enter the correct password before opening the workbook itself. With the "Alter workbook security" instruction, if a correct password is not supplied, the user will not be able to see anything inside the workbook.
However, with the "Alter workbook protection" instruction (the subject of this article), if a correct password is not supplied, the user will still be able to see the contents of the workbook, but will not be able to modify the structure or window of the workbook.
Creating the step
Firstly, create an action step to manipulate data and select "Alter workbook protection" instruction.
You will then be presented with the following form.
Firstly, you need to link the relevant Excel workbook.
This form is quite simple: if all you want to do is unprotect the workbook, then input the correct password in the textbox and the step is ready to be run.
If you want to protect a workbook, then click the "Protect?" checkbox and enter your desired password in the "New Password" textbox.
Note: there are two optional checkboxes: whether to protect the workbook's Structure and Window.
Check "Structure" if you want to prevent future users from adding, deleting, moving, renaming, hiding sheets or unhiding hidden sheets.
Check "Windows" if you want to prevent future users from moving, resizing or closing the workbook window or hiding/unhiding windows.
If you want to change the password protecting a workbook, then enter the correct password in the "Old password" textbox to first unprotect the workbook, and enter your new desired password in the "New password" textbox.