ExcelSource<TOutput>
Class ExcelSource<TOutput>
Reads data from a excel source. While reading the data from the file, data is also asnychronously posted into the targets. You can define a sheet name and a range - only the data in the specified sheet and range is read. Otherwise, all data in all sheets will be processed.
Inheritance
Inherited Members
Namespace: ETLBox.Excel
Assembly: ETLBox.Excel.dll
Syntax
Type Parameters
Name | Description |
---|---|
TOutput | Type of outgoing data |
Examples
ExcelSource<ExcelData> source = new ExcelSource<ExcelData>("src/DataFlow/ExcelDataFile.xlsx") {
Range = new ExcelRange(2, 4, 5, 9),
SheetName = "Sheet2"
};
Constructors
ExcelSource()
Declaration
ExcelSource(string)
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | uri | The source excel file name or uri |
ExcelSource(string, ResourceType)
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | uri | The source excel file name or uri |
ResourceType | resourceType | Specifies if data is loaded from a file, a web endpoint or other storage types (e.g. Azure Blob Storage) |
Properties
ExcelColumns
List of ExcelColumn attributes to map the excel column name with a property.
E.g. if the excel has a column with the header "Key", and should be written into the property "Id",
then you can simply add a ExcelColumn mapping: ExcelColumn: ColumnName "Key" -> PropertyName: "Id".
Alternatively, you can use the Index of the column, e.g. if Key is the first column: ColumnIndex "0" -> PropertyName: "Id".
Declaration
Property Value
Type | Description |
---|---|
ICollection<ExcelColumn> |
ExcelFilePassword
The password for the excel files.
Declaration
Property Value
Type | Description |
---|---|
string |
FieldHeaders
The parsed header names from the excel
Declaration
Property Value
Type | Description |
---|---|
string[] |
HasNoHeader
Indicates that the excel data doesn't has any header information. If set to true, the ExcelSource works best with ExpandoObject or string[] arrays as output type.
Declaration
Property Value
Type | Description |
---|---|
bool |
IgnoreBlankRows
If set to true, blank rows will be ignored. By default, the ExcelSource will stop reading after encountering the first blank row. Be careful if you don't define a range and set this to true.
Declaration
Property Value
Type | Description |
---|---|
bool |
IsCaseSensitiveSheetName
Only needed if SheetName is provided. By default, matching sheet names are case-insensitive. Set this property to true if you want to have the matching case-sensitive.
Declaration
Property Value
Type | Description |
---|---|
bool |
Range
The range in the excel where the data is located.
Declaration
Property Value
Type | Description |
---|---|
ExcelRange |
SheetName
The sheet name from which data should be read
Declaration
Property Value
Type | Description |
---|---|
string |
SheetNumber
The sheet number from which data should be read - will only be taken into account if SheetName is empty.
Declaration
Property Value
Type | Description |
---|---|
int? |
Methods
CheckParameter()
Declaration
Overrides
CloseReader()
Declaration
Overrides
InitReader()
Declaration
Overrides
PrepareParameterForCheck()
Declaration
Overrides
ReadAllRecords()
Declaration
Overrides
ReadFieldHeaders(string)
Reads the header names using the current configuration.
Declaration
Parameters
Type | Name | Description |
---|---|---|
string | uri | Optionally you can override the current configured Uri |
Returns
Type | Description |
---|---|
string[] | An array with the header names |