alexa
menu

Document Processing

    Show / Hide Table of Contents

    ExcelPivotTableAgentTools Class

    Provides AI agent tools for Excel pivot table operations. Handles creating, editing, removing, styling, sorting, filtering, refreshing, and laying out pivot tables using Syncfusion XlsIO. Pivot table creation and manipulation is supported only in XLSX format (Excel 2007+).

    Inheritance
    System.Object
    AgentToolBase
    AgentToolBase<IWorkbook>
    ExcelPivotTableAgentTools
    Inherited Members
    AgentToolBase<IWorkbook>.InMemoryManager
    AgentToolBase<IWorkbook>.Mode
    AgentToolBase<IWorkbook>.OpenDocument(String, String)
    AgentToolBase<IWorkbook>.SaveDocument(String, IWorkbook)
    AgentToolBase<IWorkbook>.SaveFile(String, Stream)
    AgentToolBase<IWorkbook>.StorageManager
    AgentToolBase.GetTools()
    Namespace: Syncfusion.AI.AgentTools.Excel
    Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
    Syntax
    public class ExcelPivotTableAgentTools : AgentToolBase<IWorkbook>

    Constructors

    ExcelPivotTableAgentTools(DocumentStorageManager)

    Initializes a new instance of the ExcelPivotTableAgentTools class (Mode 2 — DocumentStorage).

    Declaration
    public ExcelPivotTableAgentTools(DocumentStorageManager manager)
    Parameters
    Type Name Description
    DocumentStorageManager manager

    The document storage manager.

    ExcelPivotTableAgentTools(ExcelWorkbookManager)

    Initializes a new instance of the ExcelPivotTableAgentTools class (Mode 1 — InMemory).

    Declaration
    public ExcelPivotTableAgentTools(ExcelWorkbookManager manager)
    Parameters
    Type Name Description
    ExcelWorkbookManager manager

    The Excel workbook manager.

    Methods

    CreatePivotTable(String, String, String, String, String, String, String, String, Int32, String, String, String, String)

    Creates a pivot table in a worksheet using a data range from a source worksheet.

    Declaration
    [Tool(Name = "CreatePivotTable", Description = "Creates a pivot table in the specified worksheet using a data range from a source worksheet. Supports row, column, and data (values) fields with a chosen aggregation function. Only supported in XLSX format. workbookIdOrFilePath: The workbook ID (InMemory mode) or input file path (DocumentStorage mode).")]
    public AgentToolResult CreatePivotTable([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet containing the source data")] string dataWorksheetName, [ToolParameter(Description = "The cell range of the source data")] string dataRange, [ToolParameter(Description = "The name of the worksheet where the pivot table will be placed")] string pivotWorksheetName, [ToolParameter(Description = "The name for the new pivot table (e.g., PivotTable1)")] string pivotTableName, [ToolParameter(Description = "The top-left cell address where the pivot table starts (e.g., A1)")] string pivotLocation, [ToolParameter(Description = "Comma-separated zero-based field indices for row fields (e.g., 2,6)")] string rowFieldIndices, [ToolParameter(Description = "Comma-separated zero-based field indices for column fields (e.g., 3)")] string columnFieldIndices, [ToolParameter(Description = "Zero-based field index to use as the data/values field")] int dataFieldIndex, [ToolParameter(Description = "Caption label for the data field (e.g., Sum of Units)")] string dataFieldCaption, [ToolParameter(Description = "Built-in style name: PivotStyleLight1-28, PivotStyleMedium1-28, PivotStyleDark1-28, or None")] string builtInStyle = "None", [ToolParameter(Description = "Aggregation type: Sum, Count, Average, Max, Min, Product, CountNums, StdDev, StdDevP, Var, VarP (default: Sum)")] string subtotalType = "Sum", [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
    Parameters
    Type Name Description
    System.String workbookIdOrFilePath

    The workbook ID (InMemory mode) or input file path (DocumentStorage mode).

    System.String dataWorksheetName

    The name of the worksheet that contains the source data.

    System.String dataRange

    The cell range address of the source data (e.g., "A1:H50").

    System.String pivotWorksheetName

    The name of the worksheet where the pivot table will be placed.

    System.String pivotTableName

    The name for the new pivot table (e.g., "PivotTable1").

    System.String pivotLocation

    The top-left cell address in the pivot worksheet where the pivot table will start (e.g., "A1").

    System.String rowFieldIndices

    Comma-separated zero-based field indices to add as row fields (e.g., "2,6").

    System.String columnFieldIndices

    Comma-separated zero-based field indices to add as column fields (e.g., "3").

    System.Int32 dataFieldIndex

    Zero-based field index to use as the data (values) field.

    System.String dataFieldCaption

    Caption label for the data field (e.g., "Sum of Units").

    System.String builtInStyle

    The built-in style for the pivot table to be applied. Default is None.

    System.String subtotalType

    Aggregation function for the data field: Sum, Count, Average, Max, Min, Product, CountNums, StdDev, StdDevP, Var, VarP (default: Sum).

    System.String outputFilePath

    Output file path for saving the result (DocumentStorage mode only).

    Returns
    Type Description
    AgentToolResult

    Result indicating success or failure with the pivot table name.

    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved