Click here to Skip to main content
15,850,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to ask for the code about import MS Excel to MS Access,please.
Thank you in advance.

What I have tried:

Dim xlpath As String
Dim user As String = HttpContext.Current.User.Identity.Name
xlpath = Server.MapPath("~\ExcelFile\") & EXCEL_PATH.FileName
End Try

Dim strConn As String = "Provider = Microsoft.ACE.OLEDB.12.0;" & "Data Source = " & xlpath & ";" & "Extended Properties = Excel 8.0 ;"
Dim cnnEXCEL As OleDbConnection = New OleDbConnection(strConn)

I can write code only for this.
I wanted to example code
Updated 10-Jul-18 0:38am
F-ES Sitecore 10-Jul-18 4:52am    
google "read excel oledb c#" and you'll find loads of examples yourself.
RedDk 10-Jul-18 13:39pm    
First of all, noone can "import MS Excel to" anything. One can Export MS Excel to something. Or one can import MS Excel from something. If you tried to import MS Excel to MS Excel I suppose you would "open" MS Excel. I do have both of these apps, so I know.

1 solution

Here's an article I wrote that loads and parses an Excel file into a DataTable object hat you can then use to put into Access (or SQL Server, or whatever):
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900