I'v write the following code to insert into excel 2007 file, but excel doesn't open *.xlsx file....
after that i change file extension to *.xls ...exel opens file...but warn about "Number stored as text" for all my data....


OleDbConnection baglanti = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + path + ";Excel 12.0;HDR=YES;");

baglanti.Open();

string createTableScript = "CREATE TABLE newTable(a1 INT,a2 INT,a3 INT)";

OleDbCommand cmd = new OleDbCommand(createTableScript, baglanti);

cmd.ExecuteNonQuery();
.
.
.

string insertScript = "insert into [newTable$] (a1,a2,a3) values (" + (i + 1).ToString() + "," + (j + 1).ToString() + "," + ((int)p).ToString() + ")";

cmd = new OleDbCommand(insertScript, baglanti);
cmd.ExecuteNonQuery();