Skip to content

Instantly share code, notes, and snippets.

@MikeHook
Created August 8, 2011 16:58
Show Gist options
  • Save MikeHook/1132183 to your computer and use it in GitHub Desktop.
Save MikeHook/1132183 to your computer and use it in GitHub Desktop.
EPPlus LoadFromArrays Example
string firstName = "Bob";
string lastName = "Burton";
DateTime dateOfBirth = new DateTime(2000, 1, 1);
var testData = new List<object[]>()
{
new object[] {"First name", firstName},
new object[] {"Last name", lastName},
new object[] {"Date of birth", dateOfBirth}
};
using (var excelPackage = new ExcelPackage())
{
ExcelWorksheet excelWorksheet = excelPackage.Workbook.Worksheets.Add("Test worksheet");
//Load the summary data into the sheet, starting from cell A1. Print the column names on row 1
excelWorksheet.Cells["A1"].LoadFromArrays(testData);
}
@kambleaa007
Copy link

This gives 7 column data with additional data column which are unnesessary...

@SamKunuku
Copy link

SamKunuku commented Jan 13, 2021

Thank you for the information, very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment