Create Excels with C# and EPPlus: Import
IEnumerable objects
Exporting data to an Excel doesn’t get easier than this
using (var package = new ExcelPackage())
{
var sheet = package.Workbook.Worksheets.Add("IEnumerable");
var data = new[]
{
new {Name = "A", Value = 1},
new {Name = "B", Value = 2},
new {Name = "C", Value = 3},
};
sheet.Cells["A1"].LoadFromCollection(data);
sheet.Cells["A1"].SetHeaders("Name", "Value");
package.SaveAs(new FileInfo(@""));
}