Step 1: Form
Drag and down a button from tool box and give it name a "Create Excel File".

Step 2: Add excel library file in application
Before working for creating excel file we have to add a Excel File throw this we can access Excel properties.
To add excel file search on google As excellibrary and Open it 1st link.

Open this First link then you will see a tab for download. From here you download "excellibrary.dll" .

And extract this file into your application.
Step 3: Code
Double click on button and write this code. For this we have to add 2 namespace.
using ExcelLibrary.CompoundDocumentFormat;
using ExcelLibrary.SpreadSheet;
Before this you add reference of "excellibrary.dll" into your application for this right click on reference and "add reference" and go to browser and select .dll file.

For writing code you can copy code from this link and use this code for practice.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Text;


Uttam ChaturvediPosted Mar 16, 2021, 12:26 PM
Hi Munesh, Thanks for your solution. I would be glad to know if ExcelLibrary is comptaible with deployment to App service in cloud. I am facing issue with Interop.excel while deployment on Azure. I am looking for solution which provides excel formatting like background color and tables and can be used for cloud applications
Mohammed IbrahimPosted Jan 10, 2015, 9:18 AM
the u have given is really helpfull for me but while running the code its not returning anything
Mohammed IbrahimPosted Jan 10, 2015, 9:16 AM
hi,
Hudson LanePosted Jun 20, 2014, 2:12 AM
There is another library that allows you to create excel files (xls or xlsx) in C#/.net known as Aspose.Cells for .NET and this library provides many more features that can help you create a complete excel application without having to install MS Office to run this library. Check out this library here: http://www.aspose.com/.net/excel-component.aspx