Friends i got some codes from net by using that i can update a excel sheet ,but there we have to specify some header fields name in command string like as fallows ,
Update [Sheet1$] set ProductName=”IBG” where ProductId=5
but i want to update a single cell of excel sheet only,let say O12 cell i want to change somedata,how it is possible that i don’t know.plz help me out…
thanks in advance…
This link may help you:http://www.pcreview.co.uk/forums/thread-1176677.php To update a single cell in an existing table you useHDR=No in the extended properties of the connection string and useUPDATE sql syntax such as:UPDATE [Sheet3$A2:A2] SET F1=’TestValue1′;F1 is the default name Jet assigns to the first columnwhere the column name is unknown or invalid. The inserted value mustmatch the data type for the
Thanks for your replay i have tried but some error is comeing ,i have written as fallows, String sConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0;” + “Data Source=” + path + “;” + “Extended Properties=’Excel 8.0;HDR=NO'”; OleDbConnection objConn = new OleDbConnection(sConnectionString); objConn.Open(); OleDbCommand objCmdSelect = new OleDbCommand(“UPDATE [Sheet1$A2:A2] SET F1=’TestValue1′”, objConn); objCmdSelect.ExecuteNonQuery(); objConn.Close(); the error is=”No value given for one or more required parameters.” here i am not getting where is the error plz help me ,plz give me some codes to do update a single cell of excel sheet.
This worked on my machine (after I changed the update value from text to int so it would match the cell type) String sConnectionString = @”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:TempBook1.xls;Extended Properties=’Excel 8.0;HDR=NO'”;