Friday, September 17, 2010

Export excel sheet to SQL Database Table

Insert data into Sql table read from excel sheet. OPENROWSET() is a method for read the data from excel sheet. Before we run this script make sure that 'Testexcel.xls’ is avilable in 'C' Drive.

INSERRT INTO tbL_excel
SELECT *
FROM OPENROWSET
(
Microsoft.Jet.OLEDB.4.0′,
Excel 8.0;Database=\\C\Testexcel.xls’,
SELECT * FROM [Sheet1$]
)
 
Note: It is not work for windows 2007 excel sheets. Because those sheet extenction is '.xlsx'

No comments:

Post a Comment