issue writing to spreadsheet using EPPlus
Posted
by
Andy
on Stack Overflow
See other posts from Stack Overflow
or by Andy
Published on 2014-06-09T08:57:09Z
Indexed on
2014/06/09
9:24 UTC
Read the original article
Hit count: 293
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.
© Stack Overflow or respective owner