# PivotTable Class

> PivotTable class in the TX Sheet Control .NET API: Operational pivot handle. Calls reject after document replacement or pivot removal.

- **Product:** TX Sheet Control
- **Section:** Documentation
- **Kind:** Class
- **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)
- **Inherits:** `TXTextControl.TXSheetControl.Server.DocumentObject`
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > PivotTable Class
- **1402 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/llms-full.txt

---

Operational pivot handle. Calls reject after document replacement or pivot removal.

Pivot handles are obtained through the owning workbook or worksheet collection.

### Members

| Member | Description |
|---|---|
| [Id](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/id-property/llms-full.txt) | Stable identity within the owning workbook. |
| [GetSnapshotAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getsnapshotasync-method/llms-full.txt) | Reads detached current settings and the last materialized output range. |
| [GetNameAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getnameasync-method/llms-full.txt) | Reads the unique display name. |
| [GetFieldsAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getfieldsasync-method/llms-full.txt) | Lists source and calculated field names. |
| [GetItemsAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getitemsasync-method/llms-full.txt) | Lists distinct typed or grouped field members, including blank members. |
| [UpdateAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/updateasync-method/llms-full.txt) | Applies a camelCase partial settings object and refreshes atomically. Unspecified settings remain unchanged. |
| [RefreshAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/refreshasync-method/llms-full.txt) | Re-reads the live source and writes result cells in one undo step. |
| [GetResultAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getresultasync-method/llms-full.txt) | Computes detached cells and axis paths without editing the workbook. |
| [SetFiltersAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setfiltersasync-method/llms-full.txt) | Replaces report, member, label and value filters. An empty array clears filters. |
| [SetFieldsAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setfieldsasync-method/llms-full.txt) | Sets the rows or columns axis; fields include sorting and grouping settings. |
| [SetExpandedAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setexpandedasync-method/llms-full.txt) | Expands or collapses one typed member path on the rows or columns axis. |
| [DrillThroughAsync](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). |
| [GetDataAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getdataasync-method/llms-full.txt) | Returns an aggregate by value caption and optional row/column paths; parent paths select totals. |
| [CreateChartAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/createchartasync-method/llms-full.txt) | Creates a chart bound to the pivot output. Its source range follows pivot refresh and relocation. |
| [RemoveAsync](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/removeasync-method/llms-full.txt) | Removes the pivot; keepValues retains the static output. |

### Example

```csharp
using TXTextControl.TXSheetControl.Server;

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" }]
});
```

See [Pivot Tables](https://docs.textcontrol.com/tx-sheet-control/spreadsheets/pivot-tables/llms-full.txt) for field settings, output and lifetime rules.

---

## In This Section

- [PivotTable.CreateChartAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/createchartasync-method/llms-full.txt): PivotTable.CreateChartAsync method in the TX Sheet Control .NET API, with its syntax, the return type Chart and a C# example.
- [PivotTable.DrillThroughAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/drillthroughasync-method/llms-full.txt): PivotTable.DrillThroughAsync method in the TX Sheet Control .NET API: Returns up to limit contributing source records (1..100000; default 1000).
- [PivotTable.GetDataAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getdataasync-method/llms-full.txt): PivotTable.GetDataAsync method in the TX Sheet Control .NET API, with its syntax, the return type null and a C# example.
- [PivotTable.GetFieldsAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getfieldsasync-method/llms-full.txt): PivotTable.GetFieldsAsync method in the TX Sheet Control .NET API: Lists source and calculated field names. Shown with a C# example.
- [PivotTable.GetItemsAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getitemsasync-method/llms-full.txt): PivotTable.GetItemsAsync method in the TX Sheet Control .NET API: Lists distinct typed or grouped field members, including blank members.
- [PivotTable.GetNameAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getnameasync-method/llms-full.txt): PivotTable.GetNameAsync method in the TX Sheet Control .NET API: Reads the unique display name. Shown with a C# example.
- [PivotTable.GetResultAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getresultasync-method/llms-full.txt): PivotTable.GetResultAsync method in the TX Sheet Control .NET API: Computes detached cells and axis paths without editing the workbook.
- [PivotTable.GetSnapshotAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/getsnapshotasync-method/llms-full.txt): PivotTable.GetSnapshotAsync method in the TX Sheet Control .NET API: Reads detached current settings and the last materialized output range.
- [PivotTable.Id Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/id-property/llms-full.txt): PivotTable.Id property in the TX Sheet Control .NET API: Stable identity within the owning workbook. Shown with its type string and a C# example.
- [PivotTable.RefreshAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/refreshasync-method/llms-full.txt): PivotTable.RefreshAsync method in the TX Sheet Control .NET API: Re-reads the live source and writes result cells in one undo step.
- [PivotTable.RemoveAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/removeasync-method/llms-full.txt): PivotTable.RemoveAsync method in the TX Sheet Control .NET API: Removes the pivot; keepValues retains the static output.
- [PivotTable.SetExpandedAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setexpandedasync-method/llms-full.txt): PivotTable.SetExpandedAsync method in the TX Sheet Control .NET API: Expands or collapses one typed member path on the rows or columns axis.
- [PivotTable.SetFieldsAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setfieldsasync-method/llms-full.txt): PivotTable.SetFieldsAsync method in the TX Sheet Control .NET API: Sets the rows or columns axis; fields include sorting and grouping settings.
- [PivotTable.SetFiltersAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/setfiltersasync-method/llms-full.txt): PivotTable.SetFiltersAsync method in the TX Sheet Control .NET API: Replaces report, member, label and value filters. An empty array clears filters.
- [PivotTable.UpdateAsync Method](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/updateasync-method/llms-full.txt): PivotTable.UpdateAsync method in the .NET API: Applies a camelCase partial settings object and refreshes atomically. Unspecified settings remain unchanged.

---

## Nearby

- **Previous:** [OpenDocumentSpreadsheetSaveOptions.PreserveOriginal Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/opendocumentspreadsheetsaveoptions/preserveoriginal-property/llms-full.txt)
- **Next:** [PivotTable.Id Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivottable/id-property/llms-full.txt)
