A newer version of this page is available. Switch to the current version.

IExcelSchemaProvider Interface

When implemented, provides the capability to customize the schema retrieved for an Excel/CSV file.

Namespace: DevExpress.DataAccess.Excel

Assembly: DevExpress.DataAccess.v19.1.dll


public interface IExcelSchemaProvider
Public Interface IExcelSchemaProvider

Related API Members

The following members accept/return IExcelSchemaProvider objects:

Library Related API Members
Cross-Platform Class Library EditDataSourceContext.ExcelSchemaProvider
WinForms Controls EditDataSourceContext.ExcelSchemaProvider



The ExcelSchemaProvider class is registered as a default implementation of the IExcelSchemaProvider service. You can inherit from this class to customize the settings required for generating an Excel data source.


This example shows how to customize the schema of the ExcelDataSource using the ExcelDataSource.Schema property. To do this, perform the following steps.

// Creates an Excel data source and selects the specific cell range from the SalesPerson worksheet.
ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.Name = "Excel Data Source";
excelDataSource.FileName = HostingEnvironment.MapPath(@"~/App_Data/ExcelDataSource.xlsx");
ExcelWorksheetSettings worksheetSettings = new ExcelWorksheetSettings("SalesPerson", "A1:L2000");
excelDataSource.SourceOptions = new ExcelSourceOptions(worksheetSettings);

// Specifies the fields that will be available for the created data source.
IExcelSchemaProvider schemaProvider = excelDataSource.GetService(typeof(IExcelSchemaProvider)) 
    as IExcelSchemaProvider;
FieldInfo[] availableFields = schemaProvider.GetSchema(excelDataSource.FileName, null, 
    ExcelDocumentFormat.Xlsx, excelDataSource.SourceOptions, System.Threading.CancellationToken.None);
List<string> fieldsToSelect = new List<string>() { "CategoryName", "ProductName", "Country", "Quantity", 
    "Extended Price"};
foreach (FieldInfo field in availableFields) {
    if (fieldsToSelect.Contains(field.Name)) {
    else {
        field.Selected = false;
See Also