[Expand]General Information
[Expand]WinForms Controls
[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
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Collapse]Spreadsheet Document API
   Product Structure
   Getting Started
  [Expand]Spreadsheet Document
   Supported Formats
  [Expand]Cell Basics
   Defined Names
   Data Binding
  [Expand]Pivot Tables
  [Expand]Charts and Graphics
  [Expand]Mail Merge
   [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
   [Expand]Data Binding
   [Expand]Mail Merge
   [Expand]Formatting Cells
   [Expand]Conditional Formatting
   [Expand]Group Data
   [Expand]Filter Data
   [Expand]Pivot Tables
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Expand]Snap Report API
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[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). To import data into a worksheet, call the WorksheetExtensions.Import method and pass the following parameters:

  • An object that specifies a source for importing data.
  • Row and column indexes of the start cell in which you want 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.

The WorksheetExtensions class is defined in the DevExpress.Docs.v19.1.dll assembly. Add this assembly to your project to use the worksheet extensions. You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this assembly in production code. Refer to the DevExpress Subscription page for pricing information.

Expanded Import Data from Arrays

Expanded Import Data from a List

Expanded Import Data from a DataTable

The image below shows the result of executing the code above (the workbook is opened in Microsoft® Excel®).


To import data into a worksheet, you can 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.

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