[Expand]General Information
[Collapse]WinForms Controls
 [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]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
    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)

How to: Import Data to a Worksheet

You can import data to worksheet cells from different data sources (for example, arrays, lists and data tables) via the worksheet's Import extension method.

Pass the following parameters to the WorksheetExtensions.Import method.

  • An object that specifies a source for importing data.
  • Row and column indexes of the start cell in which you wish to insert imported data into the worksheet.
  • A Boolean value specifying whether to insert imported data vertically or horizontally. Use this parameter when importing data from a one-dimensional array or list.

Use of this method in production code requires a license to the DevExpress Office File API or the DevExpress Universal Subscription.

Worksheet extensions are defined by the WorksheetExtensions class. To enable them, add a reference to the DevExpress.Docs.v19.1.dll library and explicitly import the DevExpress.Spreadsheet namespace into your source code with a using directive (Imports in Visual Basic).


If you do not own the Office File API subscription and cannot reference the DevExpress.Docs.v19.1.dll, bind a read-only data source as described in the How to Bind a Spreadsheet to a List of Objects document and subsequently remove the binding using the WorksheetDataBindingCollection.Remove or WorksheetDataBindingCollection.Clear method.

Expanded Import Data from Arrays

The image below shows the results.

Expanded Import Data from a List

The image below shows the results.

Expanded Import Data from a DataTable

The following code illustrates how to import data from a System.Data.DataTable object to a worksheet. Note that the Cell Data Types are set automatically, according to the data types of the source column. Cell formats are set automatically to the default value for the cell data type. However, you can easily change them, as described in the How to: Specify Number or Date Format for Cell Content topic.

The image below shows the results.

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