0

Is there a way to read data table with ExcelDataReader using the Excel range (such as A1:B9)?

I am looking for something like:

        string tableName = "MyTable";
        string range = "A2:B9";
        using (var stream = File.Open(@"d:\temp\lte80k.xlsx", FileMode.Open, FileAccess.Read))
        {
            using (var excelDataReader = ExcelReaderFactory.CreateReader(stream))
            {
                var filteredTable = excelDataReader.GetTable(tableName, range);

                // some processing here...
            }
        }

I can see that there is a class ExcelDataReader.CellRange, but cannot figure out how to use it.

  • `CellRange` is only used to support the `MergeCells` property. – madreflection Dec 19 '19 at 18:23
  • Once you have the data into in a array you could do something like result.Tables[0].Rows[rowPosition][columnPosition] look at this question https://stackoverflow.com/questions/27634477/using-exceldatareader-to-read-excel-data-starting-from-a-particular-cell/46022604 cesAR answer may be helpful to you. – Goca Dec 19 '19 at 18:51

0 Answers0