I'm using OleDbDataAdapter
to extract DataSet
from excel file, but I have problems with SELECT
statement inside
DataSet excelDataSet = new DataSet();
using (OleDbConnection con = new System.Data.OleDb.OleDbConnection(connectionString))
{
con.Open();
OleDbDataAdapter cmd = new System.Data.OleDb.OleDbDataAdapter("select * from [Name of spreadsheet]", con);
cmd.Fill(excelDataSet);
con.Close();
}
If you see I have "select * from [Name of spreadsheet]"
, but I need to get any spreadsheets, or for example 1st spreadsheet, but the name for this spreadsheet can be anything.
How to specify it? Is it any special characters like "select * from [%]"