I have the following code which exports to a new Excel but I want to export to an existing one:
// Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
// Workbook thodoris = xla.Workbooks.Add(XlSheetType.xlWorksheet);
// Worksheet mike = (Worksheet)xla.ActiveSheet;
// xla.Visible = true;
// for (int i=1;i<dataGridView1.ColumnCount+1;i++)
// {
// xla.Cells[1, i] = dataGridView1.Columns[i - 1].HeaderText;
// }
// for (int i = 0; i < dataGridView1.RowCount; i++)
// {
// for (int j = 0; j < dataGridView1.ColumnCount; j++)
// {
// xla.Cells[i + 2, j + 1] = dataGridView1.Rows[i].Cells[j].Value.ToString();
// }
// }
How can I do that?