Question: how to export database table data into excel file in c# on button click?
Answer: Step 1: Create the instances of ExcelEngine and IApplication. ... 
Step 2: Create a new workbook instance with one worksheet.
Step 3: Create a connection string to establish a connection with a SQL Server database and query string to retrieve data from a SQL Server database similar to ADO.NET.