Table of Contents

Class XlsxWorkbook

Namespace
ExcelReader.Core.Reader.Xlsx
Assembly
ExcelReader.Core.dll

An open Office Open XML (.xlsx) workbook. Its sheets are read independently, each streaming its cells without loading the whole file into memory.

public sealed class XlsxWorkbook : IExcelWorkbook, IDisposable, IAsyncDisposable
Inheritance
XlsxWorkbook
Implements
Inherited Members

Remarks

See IExcelWorkbook for the threading and lifetime contract.

Properties

FirstSheet

Gets the workbook's first sheet: the same sheet as Sheets[0]. Opens nothing.

public XlsxSheet FirstSheet { get; }

Property Value

XlsxSheet

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 number of sheets in the workbook.

public int SheetCount { get; }

Property Value

int

Sheets

Gets the workbook's sheets, in workbook order. Reading the list opens nothing.

public ExcelSheetList<XlsxSheet> Sheets { get; }

Property Value

ExcelSheetList<XlsxSheet>

Exceptions

ObjectDisposedException

The workbook was disposed.

Tables

Gets the workbook's tables, ordered by sheet and then by the order they were created in. Opens nothing.

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 XlsxSheet)

Finds a sheet by name, ignoring case. Opens nothing.

public bool TryGetSheet(ReadOnlySpan<char> name, out XlsxSheet sheet)

Parameters

name ReadOnlySpan<char>

The sheet name to look for.

sheet XlsxSheet

The matching sheet, when one is found.

Returns

bool

true if a sheet with that name exists; otherwise false.

Exceptions

ObjectDisposedException

The workbook was disposed.

TryGetTable(ReadOnlySpan<char>, out ExcelTable)

Finds a table by name, ignoring case. Opens nothing.

public bool TryGetTable(ReadOnlySpan<char> name, out ExcelTable table)

Parameters

name ReadOnlySpan<char>

The table name to look for.

table ExcelTable

The matching table, when one is found.

Returns

bool

true if a table with that name exists; otherwise false.

Exceptions

ObjectDisposedException

The workbook was disposed.