devxlogo

Import Excel Data into SQL

Import Excel Data into 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', 1RECONFIGURE with overrideGOEXEC sp_configure 'Ad Hoc Distributed Queries', 1RECONFIGURE with overrideGOSELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:ImportFileName.xlsx','SELECT * FROM [Sheet1$]')

devx-admin

Share the Post: