Here are different ways to connect to an Excel file, including OLEDB. According to this, you can't open a password protected file with standard methods. You have to use a workaround.
If the Excel workbook is protected by
a password, you cannot open it for
data access, even by supplying the
correct password with your connection
string. If you try, you receive the
following error message: "Could not
decrypt file.
This is the solution, albeit not in C#, but you could easily adapt it for your purposes.
If you don't KNOW the password yourself, an alternative is to re-write the file without a password. You can use this handy project and add the following routine to it:
public void SaveFile()
{
this.excelWorkbook.SaveAs(
this.excelWorkbook.FullName,
vk_format,
"",
vk_write_res_password,
vk_read_only,
null,
Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
null,
vk_add_to_mru,
null,null,vk_local);
}
Full detail here.