Я нашел обходной путь :)
Public static void WriteExcel(string excelFilepath,string sheetName, string rowHeader, string columnHeader, string requiredText)
{
var excelPath = excelFilepath;
var excelApp = new Excel.Application();
//excelApp.Visible = true;
Excel.Workbook xlWorkbook = excelApp.Workbooks.Open(excelPath);
Excel.Worksheet xlSheet = xlWorkbook.Sheets[sheetName]; // get first sheet
Excel.Range xlRange = xlSheet.UsedRange; // get the entire used range
try
{
//Getting location of row and column headers location
var rowRange = xlRange.Find(rowHeader, LookAt: Excel.XlLookAt.xlWhole);
var columnRange = xlRange.Find(columnHeader, LookAt: Excel.XlLookAt.xlWhole);
//Getting Row Header X and Y values
var rowRangeX = rowRange.Column;
var rowRangeY = rowRange.Row;
//Getting Column ow Header X and Y values
var columnRangeX = columnRange.Column;
var columnRangeY = columnRange.Row;
//Setting required cell with string value
xlSheet.Cells[rowRangeY, columnRangeX].Value = requiredText;
}
finally
{
//Saving the file and closing it
excelApp.ActiveWorkbook.Save();
excelApp.Workbooks.Close();
excelApp.Quit();
}
}
}