# PivotTable.DrillThroughAsync Method

> PivotTable.DrillThroughAsync method in the TX Sheet Control .NET API: Returns up to limit contributing source records (1..100000; default 1000).

- **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 > PivotTable > PivotTable.DrillThroughAsync Method
- **1459 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/drillthroughasync-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/drillthroughasync-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/drillthroughasync-method/llms-full.txt

---

Returns up to limit contributing source records (1..100000; default 1000).

### Syntax

```csharp
public Task<Dictionary<string, JsonElement>[]> DrillThroughAsync(object?[]? rowPath = null, object?[]? columnPath = null, int limit = 1000, CancellationToken cancellationToken = default);
```

### Example

Place this code in a .NET console application that references the server package. It creates source orders and a report before applying the setting or operation.

```csharp
using TXTextControl.TXSheetControl.Server;

static string ColumnName(int index) {
    var name = "";
    for (index++; index > 0; index = (index - 1) / 26) name = (char)('A' + (index - 1) % 26) + name;
    return name;
}


await using var control = new ServerSheetControl();
var workbook = control.Workbook;
var source = await workbook.Sheets.AtAsync(0);
await source.Range("A1:D5").SetValuesAsync([
    ["Region", "Category", "Revenue", "Cost"],
    ["Europe", "Software", 1250, 500], ["Europe", "Services", 700, 350],
    ["Americas", "Software", 1800, 900], ["Americas", "Services", 950, 400]
]);
var report = await workbook.Sheets.AddAsync("Sales Pivot");
var pivot = await report.PivotTables.AddAsync(new PivotTableOptions {
    Name = "RegionalSales", Source = new() { SheetId = source.Id, Range = "A1:D5" },
    Destination = new() { SheetId = report.Id, Cell = "B3" },
    Rows = [new() { Field = "Region" }], Columns = [new() { Field = "Category" }],
    Values = [new() { Field = "Revenue", Caption = "Sales", NumberFormatCode = "$#,##0.00" }]
});

var records = await pivot.DrillThroughAsync(["Europe"], ["Software"]);
if (records.Length > 0) {
    var details = await workbook.Sheets.AddAsync("Order Details");
    var fields = records[0].Keys.ToArray();
    var rows = records.Select(record => fields.Select(field => (object?)record[field]).ToArray());
    await details.Range($"A1:{ColumnName(fields.Length - 1)}{records.Length + 1}").SetValuesAsync(new[] { fields.Cast<object?>().ToArray() }.Concat(rows).ToArray());
}
```

See [Pivot Tables](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/pivot-tables/llms-full.txt) for cache semantics, grouping, supported values and limits. Partial updates use camelCase anonymous objects; creation uses complete `PivotTableOptions`.

---

## Nearby

- **Previous:** [PivotTable.SetExpandedAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setexpandedasync-method/llms-full.txt)
- **Next:** [PivotTable.GetDataAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getdataasync-method/llms-full.txt)
