Data Management in Windows Forms Spreadsheet
23 Jul 20261 minute to read
This section explains how to import and export data in the Syncfusion® Spreadsheet control.
Import from DataTable
The following data sources can be imported into the worksheet:
- DataTable
- DataColumn
- DataView
- Business Objects
- Array
To import data from a DataTable, use the ImportDataTable method.
spreadsheet.ActiveSheet.ImportDataTable(data_table, true, 1, 1);
spreadsheet.ActiveGrid.InvalidateCells();For more details, refer to the XlsIO UG.
Export to DataTable
To export worksheet data to a DataTable, use the ExportDataTable method.
IWorksheet sheet = spreadsheet.Workbook.Worksheets[0];
IRange range = sheet.Range["A1:K50"];
DataTable data_table = sheet.ExportDataTable(range, ExcelExportDataTableOptions.ColumnNames);For more details, refer to the XlsIO UG.