Based on recommendations in other posts on how to read Excel files I tried using ExcelDataReader. I added both nuget packages and pasted in the same code
using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read))
{
// Auto-detect format, supports:
// - Binary Excel files (2.0-2003 format; *.xls)
// - OpenXml Excel files (2007 format; *.xlsx, *.xlsb)
using (var reader = ExcelReaderFactory.CreateReader(stream))
{
// Choose one of either 1 or 2:
// 1. Use the reader methods
do
{
while (reader.Read())
{
// reader.GetDouble(0);
}
} while (reader.NextResult());
// 2. Use the AsDataSet extension method
var result = reader.AsDataSet();
// The result of each spreadsheet is in result.Tables
}
}
When I try to use the sample code, including
using ExcelDataReader;
I get this error message ‘CreateReader’ does not exist in the type ‘ExcelReaderFactory’. In fact there are no methods or properties suggested from ExcelReaderFactory.
I have no other instances of ExcelReaderFactory, am using the most recent version of the nuget packages (3.6.0).
What am I missing?