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:
Hi,
I have a task assign to read excel file. Excel file is password protected. using asp.net, C# and SQL SERVER i need to updated our database.
Posted

1 solution

The best way is connect to the Excel as it was a database (using OLEDB)...
C#
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: https://msdn.microsoft.com/en-us/library/office/ff821529.aspx[^]
   

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