Home > DeveloperSection > Forums > How to export data in excel file from sql server using c# code?
Tanuj Kumar

Total Post:134

Posted on    April-10-2012 9:33 AM

 C# C# 

 3 Reply(s)
 5573  View(s)
Rate this:
Hello Everyone,
I'm facing a problem since last night, Actually I want to export SQL Server table data in MS-Excel file but I don't have idea how do it. Please help me as soon as possible.

Thanks in advance!!

Arun Singh

Total Post:68

Posted on    April-11-2012 2:17 AM

Post is removed by the User.

Arun Singh

Total Post:68

Posted on    April-11-2012 2:19 AM

Nibaal Bazzi
Nibaal Bazzi

Total Post:2

Posted on    December-03-2013 12:47 AM

Hi, MindStick DataConverter is really a very neat and straightforward software, but it seems it is stuck on version:
I hope there will be some additional improvements in the future, for example a support for newer XLSX file format.
Nevertheless Tanuj you can try this C# Excel class library, I found it very helpful in spreadsheet to database communication tasks.

// Load Excel file.
ExcelFile workbook = ExcelFile.Load("Workbook.xlsx");

// Select active worksheet from the file.
ExcelWorksheet worksheet = workbook.Worksheets.ActiveWorksheet;

// Extract the data from the worksheet to newly created DataTable.
DataTable dataTable = worksheet.CreateDataTable(new CreateDataTableOptions()
    StartRow = 0,
    StartColumn = 0,
    ColumnHeaders = true,
    ExtractDataOptions = ExtractDataOptions.StopAtFirstEmptyRow

Don't want to miss updates? Please click the below button!

Follow MindStick