I'm just trying to edit a spreadsheet that already has text written so that the text is blank.
However, it does not work. The method does not seem to do anything.
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");
}
}
}
Runtime error at runtime. It starts, ends, and the table does not change. I do not know why.
source
share