There are many situations when you have to link your server to Microsoft Excel and read the data from there. While doing that the users can encounter an error and In this article, we are going to discuss how we can fix that error.
Query to read data:
The below query can be used to read data from excel in a shared location.
SELECT * FROM OPENROWSET(
,'SELECT * FROM [EMPMASTER$]')
This will raise an error like;
OLE DB provider ‘Microsoft.ACE.OLEDB.12.0’ for linked server ‘(null)’ returned message ‘Unspecified error’.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider ‘Microsoft.ACE.OLEDB.12.0’ for linked server ‘(null)’.
The user can receive an error if the Excel file is currently opened.
Close the Excel file that is currently opened and try to execute it again.
The user can receive this error if Ad Distributed Queries are not enabled by the system administrator.
You can use sp_configure file to enable this component. Although this is an advanced option. You will also need to enable “Show Advanced Options” to enable this component.