# ServerSheetControl.LoadAsync Method

> ServerSheetControl.LoadAsync method in the TX Sheet Control .NET API: Loads workbook or UTF-8 CSV/XML/JSON tabular bytes atomically.

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

---

Loads workbook or UTF-8 CSV/XML/JSON tabular bytes atomically. Raises Loading once and Loaded only after replacement succeeds.

### 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 | Input bytes copied before notification; the caller retains ownership. |
| `streamType` | `StreamType` | No | SpreadsheetML, InternalWorkbookFormat, CSV, XML or JSON; PDF is save-only. |
| `options` | `LoadOptions?` | Yes | Reusable package and conversion limits. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels the operation. Started failures raise FileOperationFailed. |

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 and format a complete invoice before using this processing API. Return document bytes, operation metadata or notifications to the application; dispose owned controls after processing.

```csharp
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> CreateInvoiceLoadAsyncAsync(ServerSheetControl control, byte[] originalXlsx)
{
    await control.LoadAsync(originalXlsx, StreamType.SpreadsheetML);

    var sheet = await control.Workbook.Sheets.AtAsync(0);
    await sheet.Cell("A1").SetTextAsync("Reviewed invoice");
    await sheet.Cell("A1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    return await control.SaveAsync(StreamType.PDF, new SaveOptions { OmitDashboards = true });
}
```

### 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

- [ServerSheetControl Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/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:** [ServerSheetControl.LicenseInfo Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/licenseinfo-property/llms-full.txt)
- **Next:** [ServerSheetControl.LoadTextAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/serversheetcontrol/loadtextasync-method/llms-full.txt)
