Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

ExceldataReader.DataSet Extension

I have installed the nuget package exceldatareader and the extension exceldatareader.dataset but when trying to reference it in the using statement it does not recognize it

'''
using Microsoft.AspNetCore.Mvc;
using FleetManagerComLog.Models;
using ExcelDataReader;
using ExcelDataReader.DataSet;
'''

Error

I have confirmed via the NugetPackage manager that it is installed.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

When trying to add it via the using I do get the following options .Core, .Exceptions & .Log but not .DataSet.

/Edit

Error using .AsDataSet() after using ExcelDataReader has been added

/Edit 2

Image of the Solution Explorer

/Edit 3

Image of csproj file

/Thomas

>Solution :

AsDataSet() is defined in the ExcelDataReader namespace, in the ExcelDataReader.DataSet package. There’s no separate ExcelDataReader.DataSet namespace. You only need using ExcelDataReader to use AsDataSet() :

using ExcelDataReader;

...
using var stream = File.Open(filePath, FileMode.Open, FileAccess.Read));
using var reader = ExcelReaderFactory.CreateReader(stream);

var result = reader.AsDataSet();

You do have to add the ExcelDataReader.DataSet package though

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading