All docs
V21.1
21.2 (EAP/Beta)
21.1
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ExcelWorksheetSettings.WorksheetIndex Property

Allows you to bind an application or component to a sheet of an Excel file by index.

Namespace: DevExpress.DataAccess.Excel

Assembly: DevExpress.DataAccess.v21.1.dll

Declaration

public int? WorksheetIndex { get; set; }

Property Value

Type Description
Nullable<Int32>

The zero-based index of an Excel sheet to which an application or component is bound.

Remarks

The WorksheetIndex property uses zero-based indexing. The property has no effect if the WorksheetName property is specified.

Example

The example below demonstrates how to specify the WorksheetIndex property to bind an application or component to a sheet of an Excel file by index.

using DevExpress.DataAccess.Excel;
// ...
var excelDataSource = new ExcelDataSource() {
    FileName = "Path\\To\\Excel\\File.xlsx"
};

var excelWorksheetSettings = new ExcelWorksheetSettings() {
    WorksheetIndex = 0
};

var excelSourceOptions = new ExcelSourceOptions() {
    ImportSettings = excelWorksheetSettings,
    //...
};

excelDataSource.SourceOptions = excelSourceOptions;
excelDataSource.Fill();
//...
See Also