samedi 28 mars 2015

How do I write to specific cells in Excel?

How do I write to specific cells in Excel?


This works for writing to cells that have the titles "id" and "name" in the first row.



string stSheetName = "Sheet1";
string sql = "Insert into [" + stSheetName + "$] (id,name) values('5','e')";
myCommand.CommandText = sql;
myCommand.ExecuteNonQuery();


This does not work:



string sql = "Insert into [" + stSheetName + "$A2:B2] SET A2 = '5', B2 = 'e'";

Aucun commentaire:

Enregistrer un commentaire