epplus Getting started with epplus

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!


EPPlus is a .NET library that reads and writes Excel 2007/2010/2013 files using the Open Office Xml format (xlsx).

EPPlus supports:

  • Cell Ranges
  • Cell styling (Border, Color, Fill, Font, Number, Alignments)
  • Charts
  • Pictures
  • Shapes
  • Comments
  • Tables
  • Protection
  • Encryption
  • Pivot tables
  • Data validation
  • Conditional formatting
  • VBA
  • Formula calculation


VersionRelease Date
First Release2009-11-30

Getting started

//Create a new ExcelPackage
using (ExcelPackage excelPackage = new ExcelPackage())
   //Set some properties of the Excel document
   excelPackage.Workbook.Properties.Author = "VDWWD";
   excelPackage.Workbook.Properties.Title = "Title of Document";
   excelPackage.Workbook.Properties.Subject = "EPPlus demo export data";
   excelPackage.Workbook.Properties.Created = DateTime.Now;

    //Create the WorkSheet
    ExcelWorksheet worksheet = excelPackage.Workbook.Worksheets.Add("Sheet 1");

    //Add some text to cell A1
    worksheet.Cells["A1"].Value = "My first EPPlus spreadsheet!";
    //You could also use [line, column] notation:
    worksheet.Cells[1,2].Value = "This is cell B1!";

    //Save your file
    FileInfo fi = new FileInfo(@"Path\To\Your\File.xlsx");

//Opening an existing Excel file
FileInfo fi = new FileInfo(@"Path\To\Your\File.xlsx");
using (ExcelPackage excelPackage = new ExcelPackage(fi))
    //Get a WorkSheet by index. Note that EPPlus indexes are base 1, not base 0!
    ExcelWorksheet firstWorksheet = excelPackage.Workbook.Worksheets[1];
    //Get a WorkSheet by name. If the worksheet doesn't exist, throw an exeption
    ExcelWorksheet namedWorksheet = excelPackage.Workbook.Worksheets["SomeWorksheet"];

    //If you don't know if a worksheet exists, you could use LINQ,
    //So it doesn't throw an exception, but return null in case it doesn't find it
    ExcelWorksheet anotherWorksheet = 

    //Get the content from cells A1 and B1 as string, in two different notations
    string valA1 = firstWorksheet.Cells["A1"].Value.ToString();
    string valB1 = firstWorksheet.Cells[1,2].Value.ToString();

    //Save your file


Download the files from CodePlex and add them to the project.

Or install the files with the Package Manager.

PM> Install-Package EPPlus 

Got any epplus Question?