Hi All
i need code that will help me export data from my sql server database into an excel spreadsheet .
Thanx
Hi All
i need code that will help me export data from my sql server database into an excel spreadsheet .
Thanx
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Gaurav TomarRank #1,421 · 1.2K reputationPosted Aug 29, 2008, 4:06 AM EDT
Take a look on the given below link
http://www.dotnetheaven.com/UploadFile/rahul4_saxena/DataInExcelSheet05302007080823AM/DataInExcelSheet.aspx
If there is any problem than, let me know!!
Zimbini Walaza15 reputationPosted Aug 30, 2008, 1:27 AM EDT
Pero15 reputationPosted Aug 31, 2010, 12:07 AM EDT
you can easily, with just one method call, export DataTable to Excel with this Excel .NET library.
Here is a sample Excel C# code how to export DataSet to Excel:
// Create new ExcelFile.
var ef = new ExcelFile();
// Imports all the tables from DataSet to new file.
foreach (DataTable dataTable in dataSet.Tables)
{
// Add new worksheet to the file.
var ws = ef.Worksheets.Add(dataTable.TableName);
// Insert the data from DataTable to the worksheet starting at cell "A1".
ws.InsertDataTable(dataTable, "A1", true);
}
// Save the file to XLS format.
ef.SaveXls("DataSet.xls");
Satyapriya NayakRank #47 · 31.5K reputationPosted Feb 11, 2013, 10:42 PM EST
http://www.c-sharpcorner.com/uploadfile/eb5fab/export-large-data-from-gridview-to-excel-file-using-C-Sharp/default.aspx