I have a basic WinForms application and want to be able to write data from this application to an Excel spreadsheet. So far I have the following code:
Microsoft.Office.Interop.Excel.Application excelapp = new Microsoft.Office.Interop.Excel.Application();
excelapp.Visible = true;
_Workbook workbook = (_Workbook)(excelapp.Workbooks.Add(Type.Missing));
_Worksheet worksheet = (_Worksheet)workbook.ActiveSheet;
worksheet.Cells[1, 1] = "Name";
worksheet.Cells[1, 2] = "Bid";
worksheet.Cells[2, 1] = txbName.Text;
worksheet.Cells[2, 2] = txbResult.Text;
excelapp.UserControl = true;
Now what I want to do be able to do is write to an Excel file that has already been created, thus appending it. I also want it to do this all behind the scenes so that on a button click the data is written to the spreadsheet and saved without any interaction from the user. Whilst just adding data to the file NOT overwriting it.