How can I select specific columns from excel sheet rather than all columns
string connectionString = String.Format(@\"Provider=Microsoft.ACE.OLEDB.12.0;Data
What about:
SELECT * FROM [Sheet1$B14:C20]
This should select cells B14 to C20.
If you want to select the data before populating here is a good reference on advanced select statements. If you want to manipulate your data post populating your DataSet then here's how:
DataTable myTable = dataSet.Tables[0];
var myColumn = myTable.Columns["ColumnName"];
or
var myColumn = myTable.Columns[0];
To access a single field it would look something like this.
var field = myTable.Rows[0][myColumn];
This will sound trivial but this is what I understand from your question. Instead of SELECT * use SELECT [columnName1],[columnName2] FROM Sheet1.. Here columnName1 and columnName2 should be the headers of columns that you want to get from Excel Sheet.