How to get data from Excel sheet, and add that data into Ms-access database?

  • Thread starter Thread starter Nagarajan .A
  • Start date Start date
N

Nagarajan .A

I need to read an excel file, and add that data into msaccess database.
Can anyone help me?

Thanks in advance.
 
¤ I need to read an excel file, and add that data into msaccess database.
¤ Can anyone help me?
¤

Try the following:

Public Sub ImportExcelToAccess()

Dim AccessConn As New System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;"
& _
"Data Source=e:\My Documents\db1.mdb")

AccessConn.Open()

'New table
Dim AccessCommand As New System.Data.OleDb.OleDbCommand("SELECT * INTO [tblSheet1] FROM
[Excel 8.0;DATABASE=e:\My Documents\Book10.xls;HDR=NO;IMEX=1].[Sheet1$]", AccessConn)

AccessCommand.ExecuteNonQuery()
AccessConn.Close()


End Sub


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top