如何使用asp.net打开受密码保护的Excel文件并将工作表值带到数据表 [英] How To open password protected Excel File using asp.net and take sheet value to data table
本文介绍了如何使用asp.net打开受密码保护的Excel文件并将工作表值带到数据表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个任务分配来读取excel文件。 Excel文件受密码保护。使用asp.net,C#和SQL SERVER我需要更新我们的数据库。
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.
推荐答案
最好的方法是连接到Excel,因为它是一个数据库(使用OLEDB) ...
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\"");
如果要将其用作Excel文件,可以使用WorkbookObject对象的Password属性: https://msdn.microsoft.com/en-us/library/office/ff821529.aspx [ ^ ]
这篇关于如何使用asp.net打开受密码保护的Excel文件并将工作表值带到数据表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文