The JET/Access driver has a number of issues, particularly in the.NET Core era, despite the fact that it can read Excel files like databases:
- It's Windows-only
- It needs to be installed. It can't be packaged with your application
- The installed version must match the bitness (32/64-bit) of any Office components. This in turn means that your application must match Office's bitness.
Excel files can be read directly by libraries. One such choice is ExcelDataReader, which overlays an Excel page with a DbDataReader. It supports both the dated xls format and the sixteen-year-old xlsx format (yes, the "new" xlsx format was introduced in 2006, 16 years ago).
The generated data reader can be used to read the data or load a DataTable the same as any other data reader.
using (var stream = File.Open(filePath, FileMode.Open, FileAccess.Read))
using (var reader = ExcelReaderFactory.CreateReader(stream))
var table=new DataTable();