Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
1.67/5 (4 votes)
See more:
How to insert and update data in excelsheet using c#
Posted
Updated 8-Oct-13 18:04pm
v2

Insert[^]

Update[^]

Hope it will give you the idea..
 
Share this answer
 
Comments
[no name] 8-Oct-13 14:18pm    
this is ok but in this demo data are inserted in row but i am save colunm in excel sheet any plaease help.
You could easily have typed this question into Google and get an answer - I'd suggest you to look at the Microsoft.COM.Interop.Excel[^] library which is automatically installed with
Office.
 
Share this answer
 
 
Share this answer
 
Comments
[no name] 7-Oct-13 6:45am    
i am impliment your demo but i am get error like "namespace '<global namespace="">' contains a definition conflicting with alias 'Excel" ..please give this sollution
[no name] 8-Oct-13 8:50am    
I think you not added references of Excel in your solution
C#
protected void lnkExport_Click(object sender, EventArgs e)
   {
       Response.Clear();
       Response.Buffer = true;
       Response.ContentType = "application/vnd.ms-excel";
       Response.AddHeader("content-disposition", "attament;filename=SCMHatcheryReport.xls");
       Response.Charset = "";
       this.EnableViewState = false;

       System.IO.StringWriter sw = new System.IO.StringWriter();
       System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);

       GVHatcheryReport.RenderControl(htw);

       Response.Write(sw.ToString());
       Response.End();
   }

   public override void VerifyRenderingInServerForm(Control control)
   {
   }
 
Share this answer
 
Comments
[no name] 9-Oct-13 0:51am    
that is not answer of my question please try to understand question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900