There are several methods that can be used to export data from your application to excel. I will try to show you some of the most used in c# and VB .net. You need to have Excel installed on the system for this code to run properly. You can either reference the Excel object directly or use Microsoft Office Primary Interop Assemblies to open and manipulate Excel spreadsheets.
It is always important to do proper and realistic testing so I have written some flexible but simple dummy data functions to simplify these tasks.