[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications, and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Expand]Chart Control
  [Expand]Map Control
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Tables
   [Expand]Charts and Graphics
   [Expand]Mail Merge
    Operation Restrictions
    Find and Replace
   [Expand]Visual Elements
   [Expand]Keyboard Shortcuts
    [Expand]Rows and Columns
    [Collapse]Import and Export Data
      How to: Import Data to a Worksheet
      How to: Export a Worksheet Range to a DataTable
      How to: Use a Custom Converter for Export to a DataTable
    [Expand]Data Binding
    [Expand]Mail Merge
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Pivot Tables
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Import and Export Data

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.2.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.

Is this topic helpful?​​​​​​​