C# excel write
public static void SaveToExcel(string sheeetName, string columnNumber, string value)
{
//string path = Directory.GetParent(Environment.CurrentDirectory).Parent.Parent.FullName + "\\Utilities\\Testdata.xlsx";
string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\utilities\\sheet.xlsx"; ;
FileInfo newFile = new FileInfo(path);
ExcelPackage pck = new ExcelPackage(newFile);
var ws = pck.Workbook.Worksheets[sheeetName];
ws.View.ShowGridLines = false;
ws.Cells[columnNumber].Value = value;
pck.Save();
}
No comments:
Post a Comment