Working with Excel Data
24 Jul 20262 minutes to read
XlsIO supports importing and exporting data to and from Excel. This includes handling various data formats and structures, enabling you to integrate Excel with different data sources and to use Excel’s capabilities for data manipulation and analysis.
To quickly learn how to import and export data between a DataTable and Excel, watch this short video tutorial:
Import to Excel
Imports data from the following sources into an Excel worksheet:
-
DataTable to Excel — in-memory tabular data from
System.Data.DataTable. -
DataColumn to Excel — a single column of a
DataTable. -
DataView to Excel — a custom view of a
DataTable(filtered/sorted). -
Collection Objects to Excel — any
IEnumerable<T>(for example,List<T>). - Array to Excel — one-dimensional or two-dimensional object arrays.
-
Microsoft Grid Controls to Excel —
DataGridView,GridView, and similar WinForms/WebForms grids. -
HTML Table to Excel — parse an HTML
<table>snippet and import it.
NOTE
Use the ImportOnSave option to re-import data from a data source automatically when the workbook is saved.
Export from Excel
Exports data from an Excel worksheet to the following destinations:
-
Excel to DataTable — read a worksheet or range into a
System.Data.DataTable. -
Excel to Collection Objects — map rows to an
IEnumerable<T>of strongly-typed objects.
NOTE
Exporting to Microsoft Grid controls or HTML tables is not supported; use the DataTable or collection destination and bind it to the control manually.
See Also
Knowledge Base Articles
- How to use the ImportOnSave option while importing data using XlsIO?
- How to export Excel to DataTable in C#, VB.NET?
- How to export data to Excel in WPF?
- How to export DataTable to Excel with formatting in C#, VB.NET?
- How to export DataTable with images to Excel in C#, VB.NET?
- How to export a delimited string in the Excel worksheet into a collection object and add it as a string array using C#, VB.NET?
- How to import data from a dynamic collection to an Excel worksheet in C#, VB.NET?
- How to preserve a long number while exporting in XlsIO?