开发者

Get data from password protected Excel file using OleDB

开发者 https://www.devze.com 2023-03-24 06:17 出处:网络
I\'m using this connection string to access excel(2007,2010) files oleConnection.ConnectionString = @\"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\" + filepath + \";Extended Properties=\'Excel 12.

I'm using this connection string to access excel(2007,2010) files

oleConnection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + filepath + ";Extended Properties='Excel 12.0;HDR = NO;IMEX = 1;'";

this work fine until i try to get data from protected List. I know the protection开发者_开发技巧 password. So how could i access protected list?


As per MSDN you can provide the credentials with the connection string User ID=UserX;Password=UserXPassword but this works for access

But

I'm afraid. You cannot open a connection to a password-protected spreadsheet unless you have already manually opened the spreadsheet in Excel . The described error is with the Excel ODBC provider, but the behavior is identical in the Jet 4.0 OLE DB provider. Your other option is to remove the password from the spreadsheet, and rely on some other security mechanism (like restricting permissions on the folder where the file resides) to control access.

0

精彩评论

暂无评论...
验证码 换一张
取 消