Excel Data Source

  • 2 minutes to read

This tutorial shows how to add the DashboardExcelDataSource to an in-memory data source storage, and make it available to users. The specified cell range on the defined worksheet supplies the dashboard with data.

  1. In your application, create the Data folder and add the Financial.xls file to it from the C:\Users\Public\Documents\DevExpress Demos 21.2\Components\Data folder.

  2. In the Startup.cs file, create a public method that returns the configured dashboard’s data source storage (DataSourceInMemoryStorage) and define the Excel data source.

    using DevExpress.DashboardCommon;
    using DevExpress.DataAccess.Excel;
    public DataSourceInMemoryStorage CreateDataSourceStorage() {
        DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
        DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");
        excelDataSource.FileName = Path.Combine(HostingEnvironment.ContentRootPath, @"Data\Financial.xlsx");
        excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Current_Stocks"));
        dataSourceStorage.RegisterDataSource("excelDataSource", excelDataSource.SaveToXml());      
        return dataSourceStorage;


    Use the IHostingEnvironment.ContentRootPath property to set the absolute path to the directory that contains the database.

  3. Call the DashboardConfigurator.SetDataSourceStorage method to configure the data source storage. Use the created CreateDataSourceStorage method as the SetDataSourceStorage parameter.

    using DevExpress.AspNetCore;
    using DevExpress.DashboardAspNetCore;
    using DevExpress.DashboardWeb;
    public void ConfigureServices(IServiceCollection services) {
        services.AddScoped<DashboardConfigurator>((IServiceProvider serviceProvider) => {
            DashboardConfigurator configurator = new DashboardConfigurator();
            // ...
            return configurator;

    The Excel Data Source is now available in the Web Dashboard:


Users can now bind dashboard items to data in the Web Dashboard’s UI.


The example shows how to make a set of data sources available for users in the Web Dashboard application.

View Example: How to Register Data Sources for ASP.NET Core Dashboard Control