Exporting data from XLSX/XLS spreadsheet to datatable in any asp.net programming without Microsoft Office software.
XsExcel SDK not only facilitates its users to import data to worksheets from external data sources but also allow them to export their worksheet data to a DataTable.
This guide page provides C# users with how to export data from XLSX and XLS spreadsheet to Data Table with XsExcel control in C#.NET.
string filename = "DataTableSample.xlsx"; // Set the worksheet you want to export data from int sheetId = 0; // Create a workbook with local excel file Workbook workbook = new Workbook(filename); // Export data from worksheet to data table DataTable dt = workbook.ConvertSheetToDataTable(sheetId); return dt;
More Excel tutorial
- How to insert SQL database to Excel in Console Application using CSharp .NET
- C# sample code for converting dataset to Spreedsheets
- XLS formula inserted - .NET C# demo
- MS Excel read - .NET Visual C# sample
- Microsoft Excel numeric data display formatted setting in C# is quite easy and quick using XsExcel source code for .NET