Back to Devexpress

ExcelDataSource.FileName Property

corelibraries-devexpress-dot-dataaccess-dot-excel-dot-exceldatasource.md

latest6.4 KB
Original Source

ExcelDataSource.FileName Property

Gets or sets a path to the Microsoft Excel workbook or CSV file.

Namespace : DevExpress.DataAccess.Excel

Assembly : DevExpress.DataAccess.v25.2.dll

NuGet Package : DevExpress.DataAccess

Declaration

csharp
[DefaultValue(null)]
[LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)]
public string FileName { get; set; }
vb
<DefaultValue(Nothing)>
<LocalizableCategory(DataAccessStringId.PropertyGridDataCategoryName)>
Public Property FileName As String

Property Value

TypeDefaultDescription
Stringnull

A String that specifies the path to the Microsoft Excel workbook or CSV file.

|

Remarks

As an alternative, you can specify the stream containing a Microsoft Excel workbook or CSV file using the ExcelDataSource.Stream property. Specify the format of the document contained in the stream by using the ExcelDataSource.StreamDocumentFormat property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the FileName property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

data-access-library-create-data-sources-at-runtime/CS/ExcelDataSourceSnippets/Code.cs#L16

csharp
ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.FileName = "Northwind.csv";

winforms-grid-open-excel-files/CS/Form1.cs#L19

csharp
var source = new ExcelDataSource();
source.FileName = "test.xls";
var worksheetSettings = new ExcelWorksheetSettings("Sheet1", "A1:B3");

asp-net-mvc-grid-upload-excel-file-using-upload-control-and-display-data-in-grid/CS/T449148/Models/Model.cs#L25

csharp
ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.FileName = fileName;
ExcelWorksheetSettings excelWorksheetSettings = new ExcelWorksheetSettings();

reporting-winforms-bind-to-csv-file/CS/BindingReportToCsvFile/Form1.cs#L29

csharp
ExcelDataSource excelDataSource = new ExcelDataSource();
excelDataSource.FileName = "..//..//Northwind.csv";

winforms-dashboard-grid-hyperlink-column/CS/Dashboard_GridHyperlinkColumn/Form1.cs#L16

csharp
DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource("Excel Data Source");
excelDataSource.FileName = @"..\..\Data\GDPByCountry.xlsx";
excelDataSource.SourceOptions = new ExcelSourceOptions(new ExcelWorksheetSettings("Sheet1"));

data-access-library-create-data-sources-at-runtime/VB/ExcelDataSourceSnippets/Code.vb#L14

vb
Dim excelDataSource As New ExcelDataSource()
excelDataSource.FileName = "Northwind.csv"

winforms-grid-open-excel-files/VB/Form1.vb#L14

vb
Dim source = New ExcelDataSource()
source.FileName = "test.xls"
Dim worksheetSettings = New ExcelWorksheetSettings("Sheet1", "A1:B3")

asp-net-mvc-grid-upload-excel-file-using-upload-control-and-display-data-in-grid/VB/T449148_VB/Models/Model.vb#L11

vb
Dim excelDataSource As ExcelDataSource = New ExcelDataSource()
excelDataSource.FileName = fileName
Dim excelWorksheetSettings As ExcelWorksheetSettings = New ExcelWorksheetSettings()

reporting-winforms-bind-to-csv-file/VB/BindingReportToCsvFile/Form1.vb#L23

vb
Dim excelDataSource As ExcelDataSource = New ExcelDataSource()
excelDataSource.FileName = "..//..//Northwind.csv"
' Specify import settings.

reporting-winforms-bind-excel-runtime/VB/BindingReportToExcelWorkbook/Form1.vb#L22

vb
Dim excelDataSource As ExcelDataSource = New ExcelDataSource()
excelDataSource.FileName = "..//..//Northwind.xlsx"
' Select a required worksheet.

See Also

ExcelDataSource Class

ExcelDataSource Members

DevExpress.DataAccess.Excel Namespace