Namespace ExcelReader.Core.Parser
Classes
- CsvEnumerable<T>
Lazily projects CSV rows into
Tinstances by binding each property to a fixed field index, for both synchronous and asynchronous enumeration.
- ExcelCellReaders
The built-in cell readers
ExcelParser<T>'s reflection path already uses, exposed as ExcelCellReader<TValue> instances for a source-generated or hand-written ExcelRowMapBuilder<T> map to plug into Property<TValue>(string[], ExcelCellReader<TValue>, ExcelPropertySetter<T, TValue>, bool, bool) without duplicating the conversion logic.
- ExcelColumnAttribute
Maps a property to a worksheet column by header name. Apply more than once to accept alternate header spellings for the same property.
- ExcelConverterAttribute
Binds a custom IExcelCellConverter<T> to a property. The converter type must implement IExcelCellConverter<T> for the property's exact type and expose a public parameterless constructor.
- ExcelEnumerable<T>
Lazily projects XLSX rows into
Tinstances, for both synchronous and asynchronous enumeration.
- ExcelIgnoreAttribute
Excludes a property from both parsing and record writing: no column is read into it and none is written from it. Use for computed or transient properties.
- ExcelParseException
Thrown when a bound column's cell is non-empty but fails to parse into the target property type and the parser is configured to throw on parse failures (rather than silently keep the property at its default). See ThrowOnParseFailure.
- ExcelParser
Creates ExcelParser<T> instances.
- ExcelParserOptions
Options controlling how ExcelParser<T> locates the header row, matches header text to bound properties, and handles cells that fail to parse.
- ExcelParser<T>
Parses rows from an Excel or CSV sheet into instances of
T. Create one with ExcelParser: FromAttributes<T>(ExcelParserOptions?) reflects over[ExcelColumn]/[ExcelRequired]/[ExcelConverter]attributes, Generated<T>(ExcelParserOptions?) uses the[ExcelSerializable]source-generated map, and Build<T>(Action<ExcelRowMapBuilder<T>>, ExcelParserOptions?) takes a map configured at runtime.
- ExcelRequiredAttribute
Marks a property whose column must be present in the header row; parsing throws when the header is read if no matching name is found. By default every data row's cell must also be non-empty (and must parse successfully — a non-empty but unparsable cell fails the same way as a blank one), throwing on the first row that fails either check. Set AllowEmpty to true to require only the column's presence. Contrast with ThrowOnParseFailure, which governs parse-failure behavior only for non-required columns.
- ExcelRowMapBuilder<T>
Accumulates a row-to-property binding for
T, fed either by the source generator (feature A) or by a hand-written IExcelRowMap<T> implementation. Mirrors, without reflection, exactly whatTypeMapper<T>.Build()produces from attributes.
- ExcelSerializableAttribute
Marks a type for the source generator to produce IExcelRowMap<T> and IExcelRecordMap<T> implementations for, from its
[ExcelColumn]/[ExcelRequired]/[ExcelIgnore]attributes — the same sourceTypeMapper<T>'s reflection path reads, but resolved at compile time. The marked type (and every type it is nested inside, if any) must be declaredpartial, since the generator emits into an additional part of the same declaration.
Structs
- ExcelRowContext
Settings a cell reader, converter or row parser needs to convert a cell, handed to every ExcelCellReader<TValue>, ExcelRowParser<TModel> and TryConvert(in Cell, in ExcelRowContext, out T) call.
Interfaces
- IExcelCellConverter<T>
Converts a matched cell into a property value. Implement this and attach the implementation with
[ExcelConverter(typeof(MyConverter))]for types the built-in parsers do not handle (money strings, custom date formats, domain value objects, ...).
- IExcelRowMap<T>
Implemented by the source generator (feature A) — or by hand, before the generator runs — on the row model type itself, which must be
partial. Thestatic abstractmember turns "no map was generated for this model" into a compile error (Tfails thewhere T : IExcelRowMap<T>constraint on Generated<T>(ExcelParserOptions?)) instead of a silent runtime fallback to reflection.
Enums
- HeaderNormalization
Flags controlling how header text is normalized before being matched against Name or a property name.
Delegates
- ExcelCellReader<TValue>
Reads a non-empty cell into a value of type
TValue. Every built-in reader exposed by ExcelCellReaders matches this shape, so a source-generated or hand-written ExcelRowMapBuilder<T> map can plug either a built-in reader or a custom one into Property<TValue>(string[], ExcelCellReader<TValue>, ExcelPropertySetter<T, TValue>, bool, bool).
- ExcelPropertySetter<TModel, TValue>
Assigns
valueto a property ofmodel. The source generator emits this as a direct property assignment (e.g.static (ref T m, V v) => m.Prop = v) — no delegate compilation at runtime.
- ExcelRowParser<TModel>
Reads a matched, non-empty cell and assigns the result directly onto
modelin one call, instead of going through a separate ExcelCellReader<TValue> + ExcelPropertySetter<TModel, TValue> pair. Plug this into PropertyRaw(string[], ExcelRowParser<T>, bool, bool) when a single fused delegate (e.g. one emitted by the[ExcelSerializable]source generator) should replace what would otherwise be two indirect calls per bound cell per row.