Eu utilizo a biblioteca EEPLus http://epplus.codeplex.com/.
A biblioteca EPPlus também pode ser baixada pelo NuGet.
Segue exemplo de um código que gera um arquivo Excel a partir de um DataTable:
Private Sub CreateAndFormatExcel(ByVal dt As Data.DataTable)
Dim fileName As String = "exemplo.xlsx"
Using pck As New OfficeOpenXml.ExcelPackage()
'Excel Properties
pck.Workbook.Properties.Author = "Nome do Autor"
pck.Workbook.Properties.Title = "Titulo do Excel"
pck.Workbook.Properties.Company = "Nome da Empresa"
pck.Workbook.Properties.Subject = "Subject"
pck.Workbook.Properties.Comments = "Comentarios"
pck.Workbook.Properties.Manager = "Manager"
pck.Workbook.Properties.HyperlinkBase = New Uri("http://google.com")
'Create the worksheet
Dim ws As OfficeOpenXml.ExcelWorksheet = pck.Workbook.Worksheets.Add(Resources.Standard.ListaFaltas)
'Load the datatable into the sheet, starting from cell A1. Print the column names on row 1
ws.Cells("A1").LoadFromDataTable(dt, True)
Dim rangeCell As String = "A1:F1"
Using rng As OfficeOpenXml.ExcelRange = ws.Cells(rangeCell)
rng.Style.Font.Bold = True
rng.Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid
'Set Pattern for the background to Solid
rng.Style.Fill.BackgroundColor.SetColor(Drawing.Color.Red)
'Set color to dark blue
rng.Style.Font.Color.SetColor(Drawing.Color.White)
End Using
ws.Cells(rangeCell).AutoFilter = True
'Congela painel
ws.View.FreezePanes(2, 2)
'Write it back to the client
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", "attachment; filename=" & fileName & "")
Response.BinaryWrite(pck.GetAsByteArray())
Response.End()
End Using
End Sub