Open your excel file that you want to protect and go to Tools --> Options. Select the 'Security' tab.
If you want only authorized people to be able to open your workbook, then set a password in the text box for ‘Password to open’. (You can also choose any encryption type for your password by clicking on the ‘Advanced’ button)
If you want only authorized users to be able to modify your workbook, then set a password in the text box for ‘Password to modify’.
You can use any or both of these password settings based on your requirements.