Table of Contents

Class CsvReader

Namespace
ExcelReader.Core.Reader.Csv
Assembly
ExcelReader.Core.dll

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

CsvSheet

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

bool

SheetCount

Gets the sheet count. Always 1, since a CSV source has a single, unnamed sheet.

public int SheetCount { get; }

Property Value

int

Sheets

Gets the source's sheets: always exactly one, unnamed. Reading the list opens nothing.

public ExcelSheetList<CsvSheet> Sheets { get; }

Property Value

ExcelSheetList<CsvSheet>

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

IReadOnlyList<ExcelTable>

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

name ReadOnlySpan<char>

The sheet name to look for.

sheet CsvSheet

The CSV sheet, when name is empty.

Returns

bool

true if name is empty; otherwise false.

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

name ReadOnlySpan<char>

The table name to look for.

table ExcelTable

Always null.

Returns

bool

Always false.

Exceptions

ObjectDisposedException

The workbook was disposed.