Hello everyone, the problem is that I can not write to a specific file, it always creates a new file.

string mySheet = @"C:\Desktop\book.xlsx"; //Add the Content sheet Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook ObjWorkBook; Microsoft.Office.Interop.Excel.Worksheet ObjWorkSheet; ObjExcel.Visible = true; //Книга. ObjWorkBook = ObjExcel.Workbooks.Add(System.Reflection.Missing.Value); //Таблица. ObjWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)ObjWorkBook.Sheets[1]; ObjWorkSheet.Cells[3, 1] = "ff"; 

1 answer 1

If anyone needs it, here is the solution.

  var spreadsheetLocation = Path.Combine(Directory.GetCurrentDirectory(), "Sample Data.xlsx"); ObjWorkBook = ObjExcel.Workbooks.Open(spreadsheetLocation);