Class 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.
public static class ExcelCellReaders
- Inheritance
-
ExcelCellReaders
- Inherited Members
Fields
Bool
Reads a cell as "1"/"0" or "true"/"false" (case-insensitive).
public static readonly ExcelCellReader<bool> Bool
Field Value
DateOnlyAuto
Reads a cell as an Excel date serial number, falling back to date-only text when the cell isn't numeric — the DateOnly counterpart of DateTimeAuto, same trade-off.
public static readonly ExcelCellReader<DateOnly> DateOnlyAuto
Field Value
DateOnlySerial
Reads a cell as an Excel date serial number, truncated to its date component.
public static readonly ExcelCellReader<DateOnly> DateOnlySerial
Field Value
DateOnlyText
Reads a cell as date-only text rather than a serial number — the only option for CSV.
public static readonly ExcelCellReader<DateOnly> DateOnlyText
Field Value
DateTimeAuto
Reads a cell as an Excel date/time serial number, falling back to date/time text when the cell isn't numeric. Used where a single map has to work for both a serial-number source (XLSX/XLSB/XLS) and CSV (which has no serial date form and writes ISO text instead) — see Generated<T>(ExcelParserOptions?), which builds one map for every reader. The cost: a CSV cell that is only digits (e.g. an Excel serial typed as plain text) is read as a serial number, not as date text — there is no way to tell those two apart from the cell alone.
public static readonly ExcelCellReader<DateTime> DateTimeAuto
Field Value
DateTimeSerial
Reads a cell as an Excel date/time serial number.
public static readonly ExcelCellReader<DateTime> DateTimeSerial
Field Value
DateTimeText
Reads a cell as date/time text (ISO or culture format) rather than a serial number — the only option for CSV, which has no serial date form.
public static readonly ExcelCellReader<DateTime> DateTimeText
Field Value
String
Reads a cell as text.
[SuppressMessage("Naming", "CA1720:Identifier contains type name", Justification = "Matches the property type it reads, mirroring the other members of this class (Bool, DateTimeSerial, ...).")]
public static readonly ExcelCellReader<string> String
Field Value
TimeOnlyAuto
Reads a cell as an Excel time-of-day serial number, falling back to time-only text when the cell isn't numeric — the TimeOnly counterpart of DateTimeAuto, same trade-off.
public static readonly ExcelCellReader<TimeOnly> TimeOnlyAuto
Field Value
TimeOnlySerial
Reads a cell as an Excel time-of-day serial number (the fractional part of a day).
public static readonly ExcelCellReader<TimeOnly> TimeOnlySerial
Field Value
TimeOnlyText
Reads a cell as time-only text rather than a serial number — the only option for CSV.
public static readonly ExcelCellReader<TimeOnly> TimeOnlyText
Field Value
Methods
Enum<TEnum>(in Cell, in ExcelRowContext, out TEnum)
Reads a cell as an enum, by its declared value name (case-insensitive) or its underlying numeric value.
public static bool Enum<TEnum>(in Cell cell, in ExcelRowContext context, out TEnum value) where TEnum : struct, Enum
Parameters
cellCellcontextExcelRowContextvalueTEnum
Returns
Type Parameters
TEnumThe enum type to parse.
Parsable<TValue>(in Cell, in ExcelRowContext, out TValue)
Reads a cell as any type TryParse<T>(IFormatProvider?, out T) supports: every integral type, float/double/decimal, and Guid.
public static bool Parsable<TValue>(in Cell cell, in ExcelRowContext context, out TValue value) where TValue : IUtf8SpanParsable<TValue>
Parameters
cellCellcontextExcelRowContextvalueTValue
Returns
Type Parameters
TValueThe value type to parse.
SpanParsable<TValue>(in Cell, in ExcelRowContext, out TValue)
Reads a cell by decoding its text and calling TryParse(ReadOnlySpan<char>, IFormatProvider, out TSelf), for types such as TimeSpan and DateTimeOffset that have no UTF-8 parser.
public static bool SpanParsable<TValue>(in Cell cell, in ExcelRowContext context, out TValue value) where TValue : ISpanParsable<TValue>
Parameters
cellCellcontextExcelRowContextvalueTValue
Returns
Type Parameters
TValueThe value type to parse.
Utf8(scoped in Cell, scoped in ExcelRowContext, out ReadOnlySpan<byte>)
Reads a cell's raw UTF-8 bytes without allocating. The span aliases the reader's buffer and is valid only until the reader advances.
public static bool Utf8(scoped in Cell cell, scoped in ExcelRowContext context, out ReadOnlySpan<byte> value)
Parameters
cellCellcontextExcelRowContextvalueReadOnlySpan<byte>