Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [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]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheets
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [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]Tables
    [Expand]Pivot Tables
    [Expand]Printing
    [Expand]Pictures
    [Expand]Charts
    [Expand]Protection
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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 WorksheetExtensions static 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.v17.1.dll assembly and import the DevExpress.Spreadsheet namespace by adding a using directive (Imports in Visual Basic).

Important

Use of these methods in production code requires a license to the DevExpress Document Server or the DevExpress Universal Subscription.

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

How would you rate this topic?​​​​​​​