Introduction

What the article/code snippet does, why it's useful, the problem it solves etc.

Here I have Posted the simple program for Move the values
from DataBase to Excel. And it will stored in the given path.

Read the example I posted, try to implement it, when you run
into problems/errors post the code you are working with and I will try and
help you, however, going to just post a solution to your problem so
you don't have to do anything except copy & paste to get it working

Background

To export data to Excel I use the following method. This method takes
your DataSet (which is what I assume you're binding to your
DataGridView Or Directly) and populates an Excel file
with it. To make this work you need to add a reference to the
Microsoft.Excel11 Interop (or 12 for 2007, 10 for XP, etc). To do this
follow these steps

Click Project on the menu

Select Add Reference from the drop down menu

Once the dialog opens click the COM tab

Scroll down to Microsoft Excel 12.0 (or whatever version you're running) and highlight it

Click OK

Using the code

Once you've done that, add the following import statements to your file

I have a function and a sub procedure for this, one to actually create
the Excel file, and one to dump the data from the DataTable into the
Excel file. The function, aptly named CreateExcelFile takes 2 parameters, the name you want to save the file as and the DataTable that contains your data.