Excel reports in C#
How to create Excel reports in C# with formulas?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Guest UserRank #259 · 9.8K reputationPosted Jul 31, 2014, 3:28 AM EDT
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("Test");
ws.row.Cell(4).FormulaR1C1 = "=Sum(1,2,3)"
workbook.SaveAs(ms);
twitter @sumitjolly
Jonathan Sterling19 reputationPosted Jun 30, 2015, 1:42 AM EDT
ExcelFile workbook = new ExcelFile(); ExcelWorksheet worksheet = workbook.Worksheets.Add("Report"); // Set cell's value. worksheet.Cells["A1"].Value = 20; // Set cell's formula. worksheet.Cells["A2"].Formula = "=A1+10"; workbook.Save("Sample Report.xlsx");