Skip to content

LoadFromArrays

AdrianEPPlus edited this page Sep 2, 2024 · 2 revisions

The LoadFromArrays method provides an easy way of loading an IEnumerable<object[]> into a range on a worksheet.

Overview

var list = new List<object[]> {
    new object[] { 1, 2, 3 },
    new object[] { 4, 5, 6 },
    new object[] { 7, 8, 9 }
};
using var package = new ExcelPackage();
var sheet = package.Workbook.Worksheets.Add("Sheet 1");
var importedRange = sheet.Cells["A1"].LoadFromArrays(list);

InsertCols1

Transpose

You can also load the data transposed from an array by using the LoadFromArraysTransposed method.

sheet.Cells["A1"].LoadFromArraysTransposed(list);

See also

EPPlus wiki

Versions

Worksheet & Ranges

Styling

Import/Export data

Formulas and filters

Charts & Drawing objects

Tables & Pivot Tables

VBA & Protection

Clone this wiki locally