devxlogo

Importing Data from Excel into SQL Server

Importing Data from Excel into SQL Server

A very quick way to import data from Excel into SQL Server through code is to execute the following query:

SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:ExcelFileToImport.xlsx', [SheetWhereDataIsLocated$])

This is known as a Distributed Query where the connection is not persistent but rather only a quick ad hoc way of obtaining access to remote OLE data sources.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist