# PivotSource Class

> PivotSource class in the TX Sheet Control .NET API: Live worksheet source; supply exactly one range, table identity/name, or named range.

- **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)
- **Path:** TX Sheet Control > API Reference > .NET API > TXTextControl.TXSheetControl.Server > PivotSource Class
- **989 words**
- **Web URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/
- **LLMs URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/llms-full.txt

---

Live worksheet source; supply exactly one range, table identity/name, or named range.

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

### Members

| Member | Description |
|---|---|
| [SheetId](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/sheetid-property/llms-full.txt) | Stable source worksheet ID. |
| [Range](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/range-property/llms-full.txt) | A1 rectangle including a unique nonblank header row. |
| [TableId](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/tableid-property/llms-full.txt) | Source table identity or workbook-unique table name. |
| [NamedRange](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/namedrange-property/llms-full.txt) | Source defined name resolving to one worksheet rectangle. |

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

### Constructor

```csharp
public PivotSource()
```

Creates an instance with the property defaults shown in this reference. Settings are validated when applied to the owning document; result objects obtained from document operations are detached snapshots.

---

## In This Section

- [PivotSource.NamedRange Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/namedrange-property/llms-full.txt): PivotSource.NamedRange property in the TX Sheet Control .NET API: Source defined name resolving to one worksheet rectangle.
- [PivotSource.Range Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/range-property/llms-full.txt): PivotSource.Range property in the TX Sheet Control .NET API: A1 rectangle including a unique nonblank header row. Shown with its type string? and a C# example.
- [PivotSource.SheetId Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/sheetid-property/llms-full.txt): PivotSource.SheetId property in the TX Sheet Control .NET API: Stable source worksheet ID. Shown with its type string and a C# example.
- [PivotSource.TableId Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/tableid-property/llms-full.txt): PivotSource.TableId property in the .NET API: Source table identity or workbook-unique table name. Shown with its type string? and a C# example.

---

## Nearby

- **Previous:** [PivotResult.GrandTotalRows Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotresult/grandtotalrows-property/llms-full.txt)
- **Next:** [PivotSource.SheetId Property](https://docs.textcontrol.com/tx-sheet-control/reference/dotnet-api/txtextcontrol-txsheetcontrol-server/pivotsource/sheetid-property/llms-full.txt)
