dcsimg
 

Submitted by: Hannes du Preez(ojdupreez1978@gmail.com)

Friday Jul 6th 2018 by Hannes du Preez

Language: SQL, Expertise: Intermediate - Learn about how to read from an Excel Spreadsheet via SQL.

In order to read from an Excel Spreadsheet through SQL you need to install the Office 2010 Database Engine. Afterwards, run statements similar to the following:

EXEC sp_configure 'Show Advanced Options', 1
RECONFIGURE with override
GO

EXEC sp_configure 'Ad Hoc Distributed Queries', 1
RECONFIGURE with override
GO

SELECT * 
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0;Database=C:\Import\FileName.xlsx',
'SELECT * FROM [Sheet1$]')
Home
Mobile Site | Full Site