How To Import Data From Excel To Sql Server

Here is an example of how to import data from Excel or csv file into SQL Server table using OPENROWSET.

SELECT  *
FROM    OPENROWSET('Microsoft.ACE.OLEDB.12.0',
                   'Excel 12.0;Database=C:\temp\YouFileName.xlsx;HDR=YES',
                   'SELECT * FROM [Sheet1$]')
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License