Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Import csv file into excel programmatically
hi,
I want to import a csv file into my excel template file programmatically in a windows application. i am using vb.net, ado.net to do this. but i am getting an error: Operation must use an updateable query. I have checked security and it is fine. aspnet user has full permissions on both the files. I will really appreciate a quick response. following is the code: csvPath = "c:\" strCSVConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Da ta Source={0};Extended Properties=""text;HDR=No;FMT=Delimited""", csvPath) Dim objCSVConn As New OleDbConnection(strCSVConn) objCSVConn.Open() Dim objCmd As New OleDbCommand objCmd.Connection = objCSVConn Try objCmd.CommandText = "Insert INTO [Sheet1$] IN 'C:\Book1.xls' 'Excel 8.0;' SELECT * FROM 261_WildOats_12292004_EE.csv" objCmd.ExecuteNonQuery() objCSVConn.Close() Catch ex As Exception If Not (objCSVConn Is Nothing) Then objCSVConn.Close() End If MsgBox(ex.Message) End Try Thanks, Saumin |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
import a many text files to excel programmatically | Excel Discussion (Misc queries) | |||
Excel VBA - How do I programmatically change source code in another file? | Excel Programming | |||
Import IE/WE Favorites programmatically | Excel Programming | |||
Help with data importing from txt file to excel programmatically | Excel Programming | |||
programmatically close help file before Excel closes? | Excel Programming |