# Workbook.LoadAsync Method

> Workbook.LoadAsync method in the TX Sheet Control .NET API: Loads a binary document with the same reusable options as the owning control.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Server`
- **Package:** `TXTextControl.TXSheetControl.Server` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Package:** `TXTextControl.TXSheetControl.Blazor` (assembly `TXTextControl.TXSheetControl.Api.dll`, from the private NuGet feed or the supplied NuGet folder)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > Workbook > Workbook.LoadAsync Method
- **1349 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/loadasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/loadasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/loadasync-method/llms-full.txt

---

Loads a binary document with the same reusable options as the owning control.

### Syntax

#### Overload 1

```csharp
public Task<LoadResult> LoadAsync(byte[] bytes, StreamType streamType, LoadOptions? options = null, CancellationToken cancellationToken = default)
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `bytes` | `byte[]` | No | Document bytes in the selected format. |
| `streamType` | `StreamType` | No | The supported input or output format. PDF is output-only. |
| `options` | `LoadOptions?` | Yes | Supported settings for this operation; omitted settings retain documented defaults. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels waiting or execution as supported by this operation. |

Return value: `Task<LoadResult>`.

#### Overload 2

```csharp
public Task<LoadResult> LoadAsync(string fileName, StreamType streamType, LoadOptions? options = null, CancellationToken cancellationToken = default)
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `fileName` | `string` | No | Application-authorized input or output file path. |
| `streamType` | `StreamType` | No | The supported input or output format. PDF is output-only. |
| `options` | `LoadOptions?` | Yes | Supported settings for this operation; omitted settings retain documented defaults. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels waiting or execution as supported by this operation. |

Return value: `Task<LoadResult>`.

#### Overload 3

```csharp
public Task<LoadResult> LoadAsync(Stream stream, StreamType streamType, LoadOptions? options = null, CancellationToken cancellationToken = default)
```

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `stream` | `Stream` | No | Value matching stream's declared type and the owning object's validation rules. |
| `streamType` | `StreamType` | No | The supported input or output format. PDF is output-only. |
| `options` | `LoadOptions?` | Yes | Supported settings for this operation; omitted settings retain documented defaults. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels waiting or execution as supported by this operation. |

Return value: `Task<LoadResult>`.

### Examples

Create the sample document data first, then use Workbook.LoadAsync. The returned value can be used by the calling report or application.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<LoadResult> UseWorkbookLoadAsync(ServerSheetControl control, byte[] bytes)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    await sheet.Cell("B8").SetValueAsync(120);
    await sheet.Cell("B9").SetValueAsync(80);
    await sheet.Cell("B10").SetFormulaAsync("=SUM(B8:B9)");

    var workbook = book;

    var result = await workbook.LoadAsync(bytes, StreamType.SpreadsheetML, new LoadOptions());
    return result;
}
```

### Remarks

Use the member with an instance or settings object from the documented package. Await task-returning operations. Document-bound handles must be resolved again after loading or deleting their owner.

### See Also

- [Workbook Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/llms-full.txt)
- [Loading and Saving Workbooks](https://docs.textcontrol.com/tx-sheet-control/document-processing/load-save/llms-full.txt)
- [LoadOptions Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/loadoptions/llms-full.txt)
- [LoadResult Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/loadresult/llms-full.txt)
- [StreamType Enumeration](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/streamtype/llms-full.txt)

---

## Nearby

- **Previous:** [Workbook.ListNamedStylesAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/listnamedstylesasync-method/llms-full.txt)
- **Next:** [Workbook.LoadTextAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/workbook/loadtextasync-method/llms-full.txt)
