If you would like to enum Excel sheets via OleDb, you can use
OleDbConnection.GetSchema Method (String) (System.Data.OleDb)[
^]
Usage:
string sFileName = @"FullFileNmae.xlsx";
string sConStr = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 12.0;HDR=YES';", sFileName);
using (OleDbConnection connection = new OleDbConnection(sConStr))
{
connection.Open();
DataTable dt = new DataTable();
dt = connection.GetSchema("TABLES");
var sheets = dt.AsEnumerable()
.Select(x=>x.Field<string>("TABLE_NAME"))
.ToList();
}
Above code should return a list of sheet names, for example:
Sheet2$
Sheet3$
Sheet1$
Good luck!