# WorkbookDataBinding.RefreshRangeAsync Method

> WorkbookDataBinding.RefreshRangeAsync method in the TX Sheet Control .NET API: Replaces a fixed owned rectangle, optionally including column headers.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Method
- **Namespace:** `TXTextControl.TXSheetControl.Data`
- **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.Data > WorkbookDataBinding > WorkbookDataBinding.RefreshRangeAsync Method
- **1568 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshrangeasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshrangeasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshrangeasync-method/llms-full.txt

---

Replaces a fixed owned rectangle, optionally including column headers. Usable for a whole table range. Column count must match; excess rows fail before writing. Unused trailing rows are cleared to prevent stale totals. Formulas outside the rectangle are preserved. Table structure/size is retained. Target must belong to this workbook.

### Syntax

```csharp
public Task<DataSnapshot> RefreshRangeAsync(Range target, string connectionId, string queryId, DataRequest? request = null, DataQueryOptions? options = null, bool includeHeaders = true, CancellationToken cancellationToken = default)
```

### Parameters

| Parameter | Type | Optional | Description |
|---|---|---|---|
| `target` | `Range` | No | Value matching target's declared type and the owning object's validation rules. |
| `connectionId` | `string` | No | Value matching connectionId's declared type and the owning object's validation rules. |
| `queryId` | `string` | No | Value matching queryId's declared type and the owning object's validation rules. |
| `request` | `DataRequest?` | Yes | Value matching request's declared type and the owning object's validation rules. |
| `options` | `DataQueryOptions?` | Yes | Supported settings for this operation; omitted settings retain documented defaults. |
| `includeHeaders` | `bool` | Yes | Value matching includeHeaders's declared type and the owning object's validation rules. |
| `cancellationToken` | `CancellationToken` | Yes | Cancels waiting or execution as supported by this operation. |

### Return Value

`Task<DataSnapshot>`.

### Examples

Create a working report from bounded HTTP sales data. Supply an application-owned HttpClient and service URL; scope cached data to its actual audience.

```csharp
using System.Net.Http;
using TXTextControl.TXSheetControl.Data;
using TXTextControl.TXSheetControl.Server;

async Task<byte[]> BuildWorkbookDataBindingRefreshRangeAsync(ServerSheetControl control, HttpClient client, Uri serviceBase)
{
    var book = control.Workbook;
    var sheet = await book.Sheets.AtAsync(0);
    var source = new HttpDataSource(client, request => new HttpRequestMessage(HttpMethod.Get, new Uri(serviceBase, "sales?offset=" + request.Offset + "&limit=" + request.Limit)), ["Region", "Revenue"]);
    var registry = new DataSourceRegistry();
    registry.Register("sales-service", "regional-sales", source);

    var request = new DataRequest { Offset = 0, Limit = 100, Parameters = new Dictionary<string, object?> { ["year"] = 2026 } };
    var options = new DataQueryOptions { Timeout = TimeSpan.FromSeconds(15), CacheDuration = TimeSpan.FromMinutes(1), CacheScope = "public-regional-sales" };
    using var binding = new WorkbookDataBinding(book, registry);
    await binding.RefreshRangeAsync(sheet.Range("A1:B101"), "sales-service", "regional-sales", request, options);
    await sheet.Range("A1:B1").FormatAsync(new { fontFamily = "Liberation Sans", fontSize = 16, bold = true, textColor = "#ffffff", fillColor = "#163b63" });
    return await control.SaveAsync(StreamType.PDF);
}
```

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

- [WorkbookDataBinding Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/llms-full.txt)
- [Workbooks and Worksheets](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/workbooks/llms-full.txt)
- [Range Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/range/llms-full.txt)
- [DataQueryOptions Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/dataqueryoptions/llms-full.txt)
- [DataRequest Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datarequest/llms-full.txt)
- [DataSnapshot Class](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/datasnapshot/llms-full.txt)

---

## Nearby

- **Previous:** [WorkbookDataBinding.RefreshDashboardAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-data/workbookdatabinding/refreshdashboardasync-method/llms-full.txt)
- **Next:** [TXTextControl.TXSheetControl.Server Namespace](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/llms-full.txt)
