How to read values from Defined Names (Named Ranges)?

177 Views Asked by At

I'm using ExcelDataReader to read XLS files and it's working fine but I don't know how to read Defined Names.

I am able to read file contents into a DataSet:

var excelDataSet = reader.AsDataSet(new ExcelDataSetConfiguration 
{
    ConfigureDataTable = (_) => new ExcelDataTableConfiguration { UseHeaderRow = true }
});

I then take the first table from the contents:

DataTable? table = excelDataSet.Tables["MyTable"];

And I can then loop through rows and columns with

string cellValue = table.Rows[rowNumber][colNumber].ToString();

But this doesn't give me values from the so-called Defined Names (Named Ranges). How to read those?

1

There are 1 best solutions below

0
YungDeiza On

It's currently not supported in ExcelDataReader - See previous stack overflow question: How get a named range from an excel sheet using ExcelDataReader.Dataset