issue writing to spreadsheet using EPPlus
- by Andy
I'm simply trying to edit a spreadsheet that has text already written into to change the text to be blank. However its not working. the method seems to do nothing.
my code is:
public static void ClearCells(string SpreadsheetFilePath)
{
var SpreadsheetPath = new FileInfo(SpreadsheetFilePath);
var package = new ExcelPackage(SpreadsheetPath);
ExcelWorkbook workBook = package.Workbook;
if (workBook != null)
{
if (workBook.Worksheets.Count > 0)
{
ExcelWorksheet currentWorksheet = workBook.Worksheets.First();
currentWorksheet.SetValue(1, 1, "hello123");
}
}
}
There is no runtime error. It runs, completes and the spreadsheet is unchanged. I don't know why.