Class CsvReader
An open delimited-text (CSV-style) source, exposed as a workbook with a single, unnamed sheet.
public sealed class CsvReader : IExcelWorkbook, IDisposable, IAsyncDisposable
- Inheritance
-
CsvReader
- Implements
- Inherited Members
Remarks
Unlike the XLSX/XLSB/XLS readers, there are no styles or shared strings to resolve.
Properties
FirstSheet
Gets the source's only sheet.
public CsvSheet FirstSheet { get; }
Property Value
Exceptions
- ObjectDisposedException
The workbook was disposed.
IsDate1904
Gets a value indicating whether the workbook's date system is 1904-based rather than the default 1900-based system.
public bool IsDate1904 { get; }
Property Value
SheetCount
Gets the sheet count. Always 1, since a CSV source has a single, unnamed sheet.
public int SheetCount { get; }
Property Value
Sheets
Gets the source's sheets: always exactly one, unnamed. Reading the list opens nothing.
public ExcelSheetList<CsvSheet> Sheets { get; }
Property Value
Exceptions
- ObjectDisposedException
The reader was disposed.
Tables
Gets the workbook's tables: always empty, since CSV workbooks report no tables.
public IReadOnlyList<ExcelTable> Tables { get; }
Property Value
Exceptions
- ObjectDisposedException
The workbook was disposed.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
TryGetSheet(ReadOnlySpan<char>, out CsvSheet)
Checks whether name is the (empty) name of the CSV sheet, ignoring case.
public bool TryGetSheet(ReadOnlySpan<char> name, out CsvSheet sheet)
Parameters
nameReadOnlySpan<char>The sheet name to look for.
sheetCsvSheetThe CSV sheet, when
nameis empty.
Returns
Exceptions
- ObjectDisposedException
The reader was disposed.
TryGetTable(ReadOnlySpan<char>, out ExcelTable)
Finds a table by name: always fails, since CSV workbooks report no tables.
public bool TryGetTable(ReadOnlySpan<char> name, out ExcelTable table)
Parameters
nameReadOnlySpan<char>The table name to look for.
tableExcelTableAlways null.
Returns
Exceptions
- ObjectDisposedException
The workbook was disposed.