Hi Sanjeev,
You can refer to this site.
http://www.lateral8.com/articles/2010/3/5/openxml-sdk-20-export-a-datatable-to-excel.aspx
If you want to apply formatting to the excelsheet then ypu can refer to:
http://www.lateral8.com/articles/2010/6/11/openxml-sdk-20-formatting-excel-values.aspx
If you want to Apply protection to the sheet cells:
SheetProtection sheetProtection1 = new SheetProtection() { Sheet = true, Objects = true, Scenarios = true };
worksheet3.Append(sheetProtection1);
If you want to unlock a specific cell:
In CellFormat method:
if (blnIsLockedOrNot == true)
{
Protection protection = new Protection { Locked = false };
cellFormat.Append(protection);
}