# ISheetControl.LoadAsync Method

> ISheetControl.LoadAsync method in the TX Sheet Control .NET API: Loads copied bytes atomically; PDF is save-only, and early cancellation keeps the document.

- **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 > ISheetControl > ISheetControl.LoadAsync Method
- **836 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/loadasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/loadasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/loadasync-method/llms-full.txt

---

Loads copied bytes atomically. PDF is save-only. Cancellation before commit retains the original document.

### Syntax

#### Overload 1

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

#### Overload 2

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

#### Overload 3

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

### Parameters

| Name | Type | Description |
|---|---|---|
| `bytes` | `byte[]` | Copied input document bytes. |
| `streamType` | `StreamType` | Document or text format. PDF is save-only. |
| `options` | `LoadOptions?` | Optional operation settings. |
| `cancellationToken` | `CancellationToken` | Cancellation before starting the operation, with cooperative cancellation for supported file work. |
| `fileName` | `string` | A native server filesystem path. Browser hosts reject this overload. |
| `stream` | `Stream` | Caller-owned readable input or writable output stream. |

### Return Value

`Task<LoadResult>`. The awaited operation result, detached from browser transport.

### Exceptions

API failures throw `ServerSheetControlException` with a code. A canceled operation throws `OperationCanceledException`. Browser filesystem overloads and synchronous C# cell renderers throw `PlatformNotSupportedException`.

### Examples

The `control` variable is the host received by `Ready`. File examples use caller-provided `xlsxBytes`.

```csharp
await control.LoadAsync(xlsxBytes, StreamType.SpreadsheetML);
var sheet = await control.Workbook.Sheets.AtAsync(0);
await sheet.Cell("A1").SetValueAsync("Orders");
await sheet.Cell("B2").SetValueAsync(8);
```

### Remarks

Await asynchronous operations. Replacement workbook loads invalidate earlier worksheet, cell and range handles. Browser callbacks report completed notifications.

### See Also

- [ISheetControl](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/llms-full.txt).

---

## Nearby

- **Previous:** [ISheetControl.Events Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/events-property/llms-full.txt)
- **Next:** [ISheetControl.LoadTextAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/isheetcontrol/loadtextasync-method/llms-full.txt)
