# BlazorSheetControl.BatchAsync Method

> BlazorSheetControl.BatchAsync method in the TX Sheet Control .NET API: Applies collected workbook commands as one atomic undoable transaction.

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

---

Applies collected workbook commands as one atomic undoable transaction.

### Syntax

```csharp
public Task<JsonElement> BatchAsync(IReadOnlyList<WorkbookCommand> commands, CancellationToken cancellationToken = default)
```

### Parameters

| Name | Type | Description |
|---|---|---|
| `commands` | `IReadOnlyList<WorkbookCommand>` | Ordered workbook operations for an atomic transaction. |
| `cancellationToken` | `CancellationToken` | Cancellation before starting the operation, with cooperative cancellation for supported file work. |

### Return Value

`Task<JsonElement>`. 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
var sheet = await control.Workbook.Sheets.AtAsync(0);
await sheet.Cell("A1").SetValueAsync("Orders");
await sheet.Cell("B2").SetValueAsync(8);
await control.Workbook.BatchAsync(batch =>
{
    batch.SetValue(sheet.Cell("B2"), 9);
    batch.SetFormula(sheet.Cell("D2"), "=B2*12");
});
```

### Remarks

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

### See Also

- [BlazorSheetControl](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/llms-full.txt).

---

## Nearby

- **Previous:** [BlazorSheetControl Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/llms-full.txt)
- **Next:** [BlazorSheetControl.DisposeAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-blazor/blazorsheetcontrol/disposeasync-method/llms-full.txt)
