0

I am getting the below error message and am trying to find the correct syntax to specify the user id/password to connect to the excel file. Can you help with how this should be input?

OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "The Microsoft Access database engine cannot open or write to the file ''.
It is already opened exclusively by another user, or you need permission to view and write its data.".
Msg 7303, Level 16, State 1, Line 58
Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

    SELECT * 
FROM OPENROWSET(
'Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;
Database=filename;
HDR=YES;',
'SELECT * FROM sheetname')
3
  • 1
    If existing questions are any indication, you can't do this, because the OLEDB driver can't read password-protected files, period. The workarounds are mostly inapplicable to code running from SQL Server. Commented Jul 12, 2022 at 16:18
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jul 13, 2022 at 9:52
  • Ok thanks for confirming, I will try another method. Commented Jul 13, 2022 at 21:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.