code to unlock excel file
If you are using Excel 2010 or older version, you can unlock a password-protected sheet with the following macro. 1  Press Alt + F11 to open the Visual Basic Editor. 2  Right-click the workbook name on the left pane (Project-VBAProject pane) and select Insert > Module from the context menu.