first I want to say thank you all , You have a stuning Job here.
Secondly,
I Want to Import Data from Excel File to My DataGrideview columns.
I tried but data coms after My added columns.Please, Check my code bellow.

private void button8_Click_1(object sender, EventArgs e)
{
string content = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strExcelPathName.Text + "; Extended Properties=\"Excel 8.0;\";";
OleDbConnection con = new OleDbConnection(content);
OleDbDataAdapter oda = new OleDbDataAdapter("SELECT * FROM[" + txtSheet.Text + "$]", con);
DataTable dt = new DataTable();
oda.Fill(dt);
dataGridView1.DataSource = dt;
}

What do you mean by "data coms after My added columns"?

Dear ddanbe,
Means thats when columns(header) data should be come under the hears .

Suggest you have a look at this article

dear ddanbe
did'nt solve problem,
this artical is same as i made.
did u get my point ?
I Have Already DataGrideView with Headers, I want only import data from Excel file under thes headers.

ok I fetch Value of Excel File witout headers in DataGrideView but it Lefts Datagrideview Header and put these values next columns ........... what is problem?

Please check Image in link file.

Did you try this just to read a range out of an excel file?

Dear ddanbe,
I want excel data in my DataGrideView.Did u watch my image which i posted before?
Pleae, Tell me what is technique to skip cells before where excel data droped.......

I guess this is obvious from my previous post or did you not read the link? It offers a way to pick any range in excel and send it to C#.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.