John,
You can do this a couple of different ways. If you just want to populate an
existing workbook/worksheet you can use the OleDb class to accomplish this.
Just create a datasource to the workbook and open a connection. Now you will
be able to access the sheets in the workbook just like tables. I have
provided an example below to do this.
You can also use the excel object to create the workbook from scratch. I
have pasted a link to the MSDN that details how to do this with Office XP or
Office 2003. If you are using Office XP you can download the PIA to use but
if you are using Excel 2000 you will need to use the tlbimp to generate the
PIA yourself.
I hope this helps
-------------------------------------
//link
http://support.microsoft.com/kb/302084/EN-US/
//code
string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=D:\temp\queryExcelTemp.xls;" +
"Extended Properties=Excel 8.0;";
OleDbConnection conn = new OleDbConnection(strConn);
OleDbCommand cmd = new OleDbCommand();
cmd.Connection = conn;
conn.Open();
cmd.CommandText = "Insert into [Sheet1$] (FirstName, LastName)" +
" values ('Fred', 'Flintstone')";
cmd.ExecuteNonQuery();
cmd.CommandText = "UPDATE [Sheet1$] SET FirstName = 'Homer', LastName =
'Simpson' " + " WHERE FirstName = 'Joe'";
cmd.ExecuteNonQuery();
conn.Close();