Import and Export Data
- 2 minutes to read
You can import data from different data sources (such as arrays, lists or data tables) using the WorksheetExtensions.Import method, or export data to data tables using the WorksheetExtensions.CreateDataTable or WorksheetExtensions.CreateDataTableExporter method. These methods are specified as static extension methods in the static WorksheetExtensions class located in the DevExpress.Spreadsheet namespace.
Extension methods allow you to add new methods or properties to the existing class, to extend its functionality without modifying the original source directly. To use an extension method in your code, add a reference to the DLL file that contains it, and import the namespace in which the extension method is defined (for more information, refer to the Extension Methods MSDN topic). Thus, to call the SpreadsheetControl’s import or export method, add a reference to the DevExpress.Docs.v19.1.dll assembly and import the DevExpress.Spreadsheet namespace by adding a using directive (Imports in Visual Basic).
Use of these methods in production code requires a license to the DevExpress Office File API or the DevExpress Universal Subscription.
Refer to the DevExpress Subscription page for pricing information.
After you have explicitly imported the required namespace, the extension methods are available for your code file.
The following examples elaborate on the import and export techniques for the SpreadsheetControl.