Using EPPlus library to manage excel spreadsheets in .NETAbdallah Zidan
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:
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.
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: