3

I am using visual studio 2017 most updated version and Asp.Net Core 2.0 SDK to create a Web Api that needs to read excel which was uploaded earlier into Azure File Storage. Now I am able to get the excel file downloaded but I need to read and parse individual cells from the excel sheet. To achieve this currently I am trying to use Package manager NPOI (Nuget).

Below is the command I am using for this:

Pm> Install-Package NPOI -Version 2.3.0

But after running this I get the below error:

Unable to find Package from NuGet

Note, I have checked in my "Project.csproj" file for adding appropriate refernce of , but even after adding it’s not working..

Below is my Project.csproj file:

<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="Services\" />
<Folder Include="wwwroot\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="AspNetCore.NPOI" Version="2.3.0" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>

</Project>

.... Appreciate quick response!

Balaji
  • 31
  • 1
  • 2
  • Hi I am trying to convert an application from .Net framework 4.6.1 to .Net Core. In .Net 4.6.1, using OleDBAdapter class in System.Data.OleDb namespace to read and write to excel files and read data from individual column cells. But when research around to do the same in .Net Core that library is no more available. How can I do the same in .Net Core ? – VVR147493 Sep 28 '17 at 16:49

4 Answers4

3

NPOI 2.4 supports .NET core 2.0 now. Please update your NPOI package from nuget.

Tony Qu
  • 676
  • 8
  • 14
  • Does it work with Core 2.2? I just get a warning sign when I install it in my 2.2 core project but it won't tell me what the warning is not will it let me import any of the packages in. – chobo2 Dec 09 '19 at 19:05
  • Yes. We use NPOI 2.4.1 in .NET core 2.2 for some moments – Tony Qu Mar 07 '20 at 23:01
2

You can try adding [DOTNETCore.NPOI][Nuget Package], if you are working with .NET 2.0 Core App.

screenshot

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
  • Dotnetcore.NPOI is a migrated .NET core version of NPOI 2.2.1, which was released in 2016. It's too old and no bug fix at all – Tony Qu Oct 12 '20 at 23:07
1

I'll suggest you to install it through NUGET package manager. Go to VS IDE->Tools->NuGet Package Manager-> Manage NuGet Packages for Solution.

Search NPOI online and install it for your project. enter image description here

see this link too

kumar chandraketu
  • 2,232
  • 2
  • 20
  • 25
0

According to your description, I check NPOI 2.3.0 with my Net Core 2.0 Web API application. I found I could install this package successfully, but I got the following warning:

enter image description here

Then I read a .xlsx file and got the following error:

enter image description here

Then I manually installed the System.Configuration.ConfigurationManager package, but got the new error as follows:

enter image description here

Per my understanding, we could manually install SharpZipLib 1.0.0-alpha2 which may compatible with NetCore 2.0, but the NPOI may not fully compatible with your NetCore application. I have tested the same method for reading .xlsx file via NPOI under my .Net Framework project and it could work as expected. I would recommend you could use ExcelDataReader 3.2.0 or EPPlus instead of NPOI.

Bruce Chen
  • 18,207
  • 2
  • 21
  • 35