i suggest using EPPLUS because it is free and you have no problem for browser compatibility...
var dt = GetDataTable();
var dataTable = dt.Select(/);
using (ExcelPackage pck = new ExcelPackage(newFile))
{
ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Accounts");
ws.Cells["A1"].LoadFromDataTable(dataTable, true);
pck.Save();
}
you can download it with nuget.
https://www.nuget.org/packages/EPPlus/
https://epplus.codeplex.com/wikipage?title=FAQ