This is the code i’m using in my project:
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0; Data Source=C:\KursniListi.xlsx" + @";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1;ImportMixedTypes=Text;TypeGuessRows=0""";
OleDbCommand command = new OleDbCommand
(
"SELECT *" +
"FROM [Sheet1$]", conn
);
DataSet dsKL = new DataSet();
OleDbDataAdapter adapter = new OleDbDataAdapter(command);
adapter.Fill(dsKL);
dataGridView1.DataSource = dsKL.Tables[0];
}
http://uploadpic.org/v.php?img=j8nn3BtVP2
I need this to display me: rows 1 and 11, columns C,E,F
You can hide columns and rows on your datagrid using the Visible property
(I have used the index for the columns/rows because I can’t type your header names)
However without knowing the requirement to hide rows it’s difficult to give a satisfying answer.