Click here to Skip to main content
15,176,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I have a task assign to read excel file. Excel file is password protected. using, C# and SQL SERVER i need to updated our database.

1 solution

The best way is connect to the Excel as it was a database (using OLEDB)...
OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=excel_file_path;Password=password;Extended Properties=\"Excel 12.0;IMEX=0\"");

If you want to use it as Excel file you can use the Password property of the WorkbookObject object:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900