This C# sample is based upon a Microsoft Knowledge Base HOW TO article that demonstrates how to convert relational data loaded into a DataSet into a custom Excel spreadsheet. This is accomplished by using an HTTP Handler that serves the purpose of filling the DataSet with data from the Northwind database. An XML view of the DataSet (created by loading the DataSet into an XmlDataDocument class) is then transformed using XSLT into a format that can be read by Excel.
View the complete VB.NET Knowledge Base article here:
HOW TO: Transform a DataSet to Spreadsheet XML for Excel by Using Visual Basic .NET and ASP .NET (Q319180)