To be more clear, I will start from the very beginning.
I will describe a sample code found at https://exceldatareader.codeplex.com/ , but with some modifications to avoid inconvenience.
The following code defines the file format: xls or xlsx.
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read); IExcelDataReader excelReader;
Now we can access the contents of the file in a more convenient way. For this, I use a DataTable. The following is an example of accessing a specific cell and printing its value in the console:
DataTable dt = result.Tables[0]; Console.WriteLine(dt.Rows[rowPosition][columnPosition]);
If you do not want to make a DataTable, you can do the same:
Console.WriteLine(result.Tables[0].Rows[rowPosition][columnPosition]);
It is important not to try to read outside the table, for this you can see the number of rows and columns as follows:
Console.WriteLine(result.Tables[0].Rows.Count); Console.WriteLine(result.Tables[0].Columns.Count);
Finally, when you are done, you should close the reader and free resources:
//5. Free resources (IExcelDataReader is IDisposable) excelReader.Close();
I hope you find this helpful.
(I understand that the question is old, but I am making this contribution to improve the knowledge base, because there is little information about specific implementations of this library).