asp net core export to Excel

Little bit of thread necromancy here; however I wanted to share some other options that I found for any of the other search explorers out there.

ClosedXML

  • Uses AlphaNumeric Cell navigation e.g. ws.Cell("B2").Value = "Contacts";
  • Has a large amount of documentation and How To's
  • This is only for excel spreadsheets and does not have support for other Microsoft file types.
  • To install use PM> Install-Package ClosedXML

NPOI

  • Uses Numeric Cell navigation e.g.

    var rowIndex = 0; IRow row = sheet1.CreateRow(rowIndex); row.Height = 30 * 80; row.CreateCell(0).SetCellValue("this is content");

  • Supports read/write for xls, doc, ppt files.
  • To install use nuget: Install-Package DotNetCore.NPOI

EPPlus.Core

  • This is an unofficial port of the EPPlus Library to .NET Core.

somewhat relevant:

Datatables.net

I need a package that would provide me with an interface for creating Excel files.

I am not certain if you are displaying this data and are looking for a way to export it to excel but this could be an option as well if you are attempting to allow this in either an admin or public view. There are options available for customizing the output via a callback if the default output is undesirable.

  • DOM Structure documentation
  • Export Buttons
  • Excluding Specific Columns
  • Customization of Excel Export

Please find Open XML SDK.

I'm using v2.5 with ASP.NET Core + .NET4.6, but as far I know the latest version v2.7 has added support for .NET Standard 1.3 - please read the change log.


More info:

  • Where to get the NuGet package
  • Documentation
  • Open XML SDK 2.5 for Office
  • Official releases of the NuGet packages for the Open XML SDK

GrapeCity Document API for Excel supports .NET core 2.0+ (cross platform) very well, and you can try: https://www.grapecity.com/documents-api-excel

API is VSTO style and pretty straightforward:

Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.Worksheets[0];