<!-- Generated by tools/SharpCell.Docs from the XML documentation comments. Do not edit; run the tool with 'generate'. -->

# XlsxReader

```csharp
public static class XlsxReader
```

Namespace `SharpCell.Xlsx` · package `SharpCell.Xlsx`

Reads .xlsx workbooks: sheets, values, formulas with the results Excel cached, defined names, tables, hidden rows, whether a sheet is filtered, the date system, number formats, cell styles, column widths, row heights, merged cells, frozen panes and gridlines, from .xlsx and macro-enabled .xlsm files. Charts, pivot tables and macros are not read (a save keeps them; macros never run).

Every formula is out of date after loading: [Cell.Value](SharpCell.Cell.md#value) shows the value cached in the file until [Workbook.Recalculate](SharpCell.Workbook.md#recalculate-cancellationtoken) calculates it. A formula SharpCell cannot parse (for example a link to another workbook) does not fail the load; once calculated it is `#NAME?` and listed in [Workbook.Diagnostics](SharpCell.Workbook.md#diagnostics).

The workbook keeps the file's bytes in memory, so [XlsxWriter](SharpCell.Xlsx.XlsxWriter.md) can write changes into the same file.

## Methods

<a id="load-stream"></a>
### Load(Stream)

```csharp
public static Workbook Load(Stream stream)
```

Reads a workbook from a stream, which is left open.

**Parameters**

- `stream`: The .xlsx content; it need not be seekable.

**Returns:** The workbook, with the results Excel saved until it is recalculated.

**Exceptions**

- `InvalidDataException`: The file is not a well-formed .xlsx workbook.
- `NotSupportedException`: The file is .xls, .xlsb or encrypted.

<a id="load-string"></a>
### Load(string)

```csharp
public static Workbook Load(string path)
```

Reads a workbook from a file.

**Parameters**

- `path`: Path of the .xlsx file.

**Returns:** The workbook, with the results Excel saved until it is recalculated.

**Exceptions**

- `InvalidDataException`: The file is not a well-formed .xlsx workbook.
- `NotSupportedException`: The file is .xls, .xlsb or encrypted.
