Try This method,It works properly.
<pre lang="cs">public void export_datagridview_to_excel(System.Windows.Forms.DataGridView dgv, string excel_file)
{
int cols;
StreamWriter wr = new StreamWriter(excel_file);
cols = dgv.Columns.Count;
for (int i = 0; i < cols; i++)
{
wr.Write(dgv.Columns[i].HeaderText.ToString() + "\t");
wr.Write("\t");
wr.Write(dgv.Rows[0].Cells[i].Value + "\r\n");
}
wr.Close();
}