Excel sheets are mostly used for reporting purposes and reports mostly based on confidential data, so security is very important for Excel based reports.
Here is the code in visual studio to protect the excel sheet
1) Open vb console application and add this code
Module Module1
Sub Main()
Dim strfilename As String = "c:\dwreport.xls"
Dim strnewfilename As String = "c:\protectedhehadwreport.xls"
Dim strPassword As String = "yourpassword"
Dim objExcel As New Microsoft.Office.Interop.Excel.Application
Dim objWorkbook As Microsoft.Office.Interop.Excel.Workbook
objWorkbook = objExcel.Workbooks.Open(strFilename)
objExcel.DisplayAlerts = False
objWorkbook.SaveAs(strnewfilename, Password:=strPassword)
objWorkbook.Close()
objExcel = Nothing
Return
End Sub
End Module
2) Go to project, add references and add microsoft excel libraries from .COM