Export DataGridView Data to Excel in C# – C# Programming Example
Windows Form

Export DataGridView Data to Excel in C#

Firstly, we create a form as following.

 

And then Add a reference by right clicking to the “References”  in the Solution Explorer.  

Then we will see the Reference Manager in the panel. We have to add the  Microsoft Excel 16.0 Object Library into our project as a reference for exporting to the Excel.

After the adding is finished, let’s start the project.

Don’t forget to add those refereces to using.

 

Button1_Click event

All of the Codes:

Output:

 

 

2 Comments

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: