I want to export the excel file using c# and in excel it should have a ribbon (button in excel) called as refresh which will get the latest data from server.
You should have a look at VSTO. Visual Studio Tools for Office allows you to customize Office applications, using .Net. For Excel, you can customize specific documents or write add-ins, working from Visual Studio, in VB.Net or C#.