NPOI is an open-source .NET project that provides an easy-to-use API for working with Microsoft Office file formats. It supports various file formats for Excel, Word, and PowerPoint such as XLS, XLSX, DOC, DOCX, PPT, and PPTX. We are going to have a look at installing NPOI API for working with Spreadsheet documents.

Installing NPOI

NPOI can be installed using two methods.

  • Installation from GitHub Repository
  • Installation from NuGET

Installing NPOI from GitHub Repository

Step 1: Download NPOI API – The first step is to download the NPOI API. You can download the latest version of NPOI from the official NPOI GitHub repository.
Click on the latest release and download the “npoi-bin-x.x.x.zip” file.

Step 2: Extract the files – Once you have downloaded the NPOI API, extract the contents of the “npoi-bin-x.x.x.zip” file to a folder on your computer. For example, you can extract the contents to “C:\npoi”.

Step 3: Add references to your project – If you have installed NPOI from the GitHub repo using the above steps, you will need to add references to the NPOI DLL files as shown in the steps below.

  1. In Visual Studio, open your project.
  2. In the Solution Explorer, right-click on the project and select “Add Reference”.
  3. In the “Reference Manager” window, select the “Browse” tab.
  4. Browse to the “C:\npoi\bin” folder and select the following DLL files:
    • NPOI.dll
    • NPOI.OOXML.dll
    • NPOI.OpenXml4Net.dll
    • NPOI.OpenXmlFormats.dll
  5. Click “OK” to add the references.

Installing NPOI using NuGet Package Manager

Step 1: Open Visual Studio – Open Visual Studio and create a new project or open an existing project if you want to add NPOI to.

Step 2: Open the Package Manager Console – To open the Package Manager Console, go to “Tools” > “NuGet Package Manager” > “Package Manager Console”.

Step 3: Install the NPOI Package – In the Package Manager Console, type the following command and press Enter:

Install-Package NPOI

This will install the latest version of NPOI and all its dependencies.

In our next articles, we’ll talk about:

So stay tuned.