Using EPPlus library to manage excel spreadsheets in .NET

Using EPPlus library to manage excel spreadsheets in .NET

EPPlus is a library to manage excel spreadsheets, using OOXML. To install EPPlus, you can search for EPPlus in “NuGet Package Manager” or simply run the following command in the “Package Manager Console”:

PM> Install-Package EPPlus

After installing we are going to need to use this namespace:

using OfficeOpenXml;

I got an exception while reading from an excel spreadsheet I already saved with this library before:

An exception of type ‘system.indexoutofrangeexception’ occurred in EPPlus.dll but was not handled in user code.

using epplus library to manage excel spreadsheets in dot net 1

The idea is that as you working with excel files there are different extensions and also different encoding with same extension.

For instance “Strict Open XML Spreadsheet” extension is “xlsx” and “Excel Workbook” extension is “xlsx” also but with different formatting and encoding.

So the library will work only when saving the excel file as “Excel Workbook (*.xlsx)” and it will not work with “Strict Open XML Spreadsheet (*.xlsx)”, in spite of they have the same extension as shown in the figure below:

using epplus library to manage excel spreadsheets in dot net 2

Share this post

Comment (1)

  • Jack Green Reply

    You can also try Zet Excel platform. I use it

    July 27, 2020 at 1:54 PM

Leave a Reply

Your email address will not be published. Required fields are marked *