From a31032fff364f50b6f33041a2228e7728f59ee6f Mon Sep 17 00:00:00 2001 From: Dinko Krastev Date: Fri, 7 Aug 2026 16:52:24 +0300 Subject: [PATCH] Spreadsheet add AI assistant article. --- ...if => radbuttons-features-smart-paste.gif} | Bin .../radspreadsheet/features/ai-assistant.md | 304 ++++++++++++++++++ .../features/command-descriptors.md | 2 +- controls/radspreadsheet/features/comments.md | 2 +- .../features/conditional-formatting.md | 1 + .../radspreadsheet/features/copy-and-paste.md | 1 + .../features/find-and-replace.md | 1 + controls/radspreadsheet/features/history.md | 1 + .../images/spreadsheet-ai-assistant-001.png | Bin 0 -> 176512 bytes .../images/spreadsheet-ai-assistant-002.png | Bin 0 -> 3526 bytes controls/radspreadsheet/features/notes.md | 2 +- .../radspreadsheet/features/protection.md | 1 + controls/radspreadsheet/features/ui-charts.md | 2 +- .../radspreadsheet/features/ui-filtering.md | 2 +- .../features/ui-freeze-panes.md | 2 +- .../features/ui-headers-and-footers.md | 2 +- .../features/ui-hidden-rows-columns.md | 2 +- .../radspreadsheet/features/ui-printing.md | 2 +- .../radspreadsheet/features/ui-sorting.md | 2 +- .../features/ui-working-with-selection.md | 2 +- .../ui-worksheet-editor-context-menu.md | 2 +- .../features/ui-worksheet-editor-dialogs.md | 2 +- .../features/worksheetuilayersbuilder.md | 2 +- 23 files changed, 323 insertions(+), 14 deletions(-) rename controls/radbuttons/features/images/{smart-paste.gif => radbuttons-features-smart-paste.gif} (100%) create mode 100644 controls/radspreadsheet/features/ai-assistant.md create mode 100644 controls/radspreadsheet/features/images/spreadsheet-ai-assistant-001.png create mode 100644 controls/radspreadsheet/features/images/spreadsheet-ai-assistant-002.png diff --git a/controls/radbuttons/features/images/smart-paste.gif b/controls/radbuttons/features/images/radbuttons-features-smart-paste.gif similarity index 100% rename from controls/radbuttons/features/images/smart-paste.gif rename to controls/radbuttons/features/images/radbuttons-features-smart-paste.gif diff --git a/controls/radspreadsheet/features/ai-assistant.md b/controls/radspreadsheet/features/ai-assistant.md new file mode 100644 index 0000000000..8805ffbbdb --- /dev/null +++ b/controls/radspreadsheet/features/ai-assistant.md @@ -0,0 +1,304 @@ +--- +title: AI Assistant +page_title: AI Assistant +description: Check our AI Assistant documentation article for the RadSpreadsheet {{ site.framework_name }} control. +slug: radspreadsheet-ai-assistant +tags: ai, assistant, spreadsheet, chat, analysis +published: True +position: 0 +--- + +# AI Assistant for RadSpreadsheet + +RadSpreadsheet provides an AI-powered assistant that transforms how you interact with spreadsheet data. Instead of manually navigating menus, clicking through dialogs, and writing complex formulas, you can simply describe what you want to accomplish in natural language. The AI assistant understands your intent and executes the necessary operations automatically. + +This intelligent feature leverages Large Language Models (LLMs) to perform a wide range of spreadsheet operations through a conversational interface. You can ask questions about your data, request calculations, create and modify worksheets, generate formulas, apply formatting, analyze trends, and even create charts—all by typing or speaking naturally. + +**What you can accomplish with the AI Assistant:** + +* **Data Analysis** — Ask questions like "What's the average revenue per quarter?" or "Show me the top 5 products by sales" and get instant answers +* **Formula Generation** — Request formulas in plain language: "Calculate the year-over-year growth percentage" without memorizing Excel syntax +* **Worksheet Management** — Create, rename, delete, or reorganize worksheets with simple commands like "Create a new worksheet for Q2 data" +* **Content Manipulation** — Update cell values, clear ranges, or format data by describing the desired outcome: "Format the revenue column as currency" +* **Statistical Calculations** — Compute sums, averages, minimums, maximums, and other statistics across any range without writing formulas +* **Chart Creation** — Generate visual representations of your data: "Create a bar chart comparing monthly expenses" +* **Complex Operations** — Execute multi-step tasks in a single command: "Find all sales over $10,000, calculate the total, and create a summary in a new worksheet" + +The AI assistant uses the [AI Agent Tools from the Document Processing Libraries](https://www.telerik.com/document-processing-libraries/documentation/ai-tools/agent-tools/overview), which provides specialized capabilities for spreadsheet manipulation. The integrated chat panel appears alongside your spreadsheet, allowing seamless interaction without interrupting your workflow. You can connect to various AI providers including Azure OpenAI, OpenAI, and local AI models through Ollama. + +![RadSpreadsheet AI Summarization](images/spreadsheet-ai-assistant-001.png) + +## Required NuGet Packages + +The AI assistant feature requires the installation of several additional packages beyond those needed for the RadSpreadsheet control. + +### Required Packages + +* Azure.AI.OpenAI +* Microsoft.Extensions.AI.OpenAI +* Microsoft.Extensions.Logging.Debug +* Microsoft.Web.WebView2 + +>The RadSpreadsheet AI feature uses the [Microsoft.Extensions.AI](https://www.nuget.org/packages/Microsoft.Extensions.AI) abstractions to provide a flexible, extensible AI integration. These packages allow you to connect to various AI providers including Azure OpenAI, OpenAI, Ollama, and other services that implement the `IChatClient` interface. The actual spreadsheet manipulation capabilities are provided by the [AI Agent Tools](https://www.telerik.com/document-processing-libraries/documentation/ai-tools/agent-tools/spreadsheet-document-api). + +## Available AI Tools + +The `AIToolsProvider` automatically configures five categories of spreadsheet manipulation tools that enable comprehensive interaction with spreadsheet data through natural language. These tools are based on the [Spreadsheet Document API](https://www.telerik.com/document-processing-libraries/documentation/ai-tools/agent-tools/spreadsheet-document-api) from the Document Processing Libraries. + +### Read Tools (SpreadProcessingReadAgentTools) + +The Read Tools allow the AI agent to extract and analyze data from spreadsheets: + +* **Read cell values** — Retrieve values from specific cells or cell ranges +* **Get worksheet information** — Access worksheet names, active worksheet, and worksheet count +* **Analyze cell ranges** — Read data from named ranges and complex selections +* **Extract formatted data** — Retrieve both raw values and formatted text from cells + +**Example commands:** +- "What is the value in cell B5?" +- "Show me all data in the range A1:D10" +- "What worksheets are available in this workbook?" + +### Write Tools (SpreadProcessingWriteAgentTools) + +The Write Tools enable the AI agent to modify spreadsheet content and structure: + +* **Set cell values** — Write data to individual cells or ranges +* **Update cell content** — Modify existing cell values with new data +* **Clear cell ranges** — Remove content from specified cells +* **Format cells** — Apply formatting such as number formats, fonts, and colors +* **Merge and unmerge cells** — Combine or separate cells in the spreadsheet + +**Example commands:** +- "Set cell A1 to 'Total Revenue'" +- "Write the values 100, 200, 300 into cells B1, B2, and B3" +- "Clear the contents of the range C5:E10" + +### Formula Tools (SpreadProcessingFormulaAgentTools) + +The Formula Tools allow the AI agent to work with Excel formulas and calculations: + +* **Generate formulas** — Create appropriate Excel formulas based on natural language descriptions +* **Apply formulas to cells** — Insert formulas into specific cells or ranges +* **Evaluate expressions** — Calculate results using Excel functions +* **Create complex calculations** — Build nested formulas with multiple functions +* **Reference cell ranges** — Use cell references and named ranges in formulas + +**Example commands:** +- "Create a SUM formula in D10 that adds up cells D1 to D9" +- "Apply an AVERAGE formula to calculate the mean of the values in column C" +- "Add a formula to calculate percentage change between column A and column B" + +### Worksheet Tools (SpreadProcessingWorksheetAgentTools) + +The Worksheet Tools provide AI control over worksheet management: + +* **Create worksheets** — Add new worksheets to the workbook +* **Delete worksheets** — Remove existing worksheets +* **Rename worksheets** — Change worksheet names +* **Activate worksheets** — Switch the active worksheet +* **Reorder worksheets** — Change the order of worksheets in the workbook +* **Copy worksheets** — Duplicate existing worksheets + +**Example commands:** +- "Create a new worksheet named 'Sales Q1 2025'" +- "Delete the worksheet called 'Temporary Data'" +- "Rename the current worksheet to 'Annual Summary'" +- "Move the 'Revenue' worksheet to the first position" + +### Analysis Tools (SpreadProcessingAnalysisAgentTools) + +The Analysis Tools enable the AI agent to perform data analysis and generate insights: + +* **Statistical calculations** — Compute sums, averages, min/max values, and other statistics +* **Data aggregation** — Group and summarize data across ranges +* **Pattern recognition** — Identify trends and patterns in the data +* **Conditional analysis** — Find data meeting specific criteria +* **Chart generation** — Create visual representations of data +* **Data comparison** — Compare values across different ranges or worksheets + +**Example commands:** +- "Find the highest value in the 'Revenue' column" +- "Calculate the average of all positive numbers in the range E1:E50" +- "Generate a chart showing monthly sales trends" +- "What is the total sum of all values in the 'Expenses' worksheet?" +- "Identify cells where the value is greater than 1000" + +### Natural Language Processing + +All tools work together to process complex, multi-step natural language commands. The AI agent can: + +* Interpret context-aware requests +* Execute multiple operations in sequence +* Make intelligent decisions about data placement and formatting +* Handle ambiguous requests by asking clarifying questions +* Provide explanations of actions taken + +**Example complex commands:** +- "Analyze the sales data in worksheet 'Q1', calculate the total, and create a summary in a new worksheet" +- "Find all products with revenue over $10,000 and create a filtered list in column F" +- "Create a monthly comparison chart showing the difference between actual and budgeted expenses" + +>For detailed information about the underlying AI tools and their capabilities, see the [AI Agent Tools documentation](https://www.telerik.com/document-processing-libraries/documentation/ai-tools/agent-tools/overview) and the [Spreadsheet Document API reference](https://www.telerik.com/document-processing-libraries/documentation/ai-tools/agent-tools/spreadsheet-document-api). + +## Enabling the AI Assistant + +The AI assistant is represented by a chat panel that allows you to interact with the spreadsheet using natural language. To enable the AI features, set the `IsAIEnabled` property to `true`. This property activates the AI functionality and makes the AI panel available. + +#### __[XAML] Setting IsAIEnabled in XAML__ +```XAML + +``` + +#### __[C#] Setting IsAIEnabled in code-behind__ +```C# +this.radSpreadsheet.IsAIEnabled = true; +``` + +#### __[VB.NET] Setting IsAIEnabled in code-behind__ +```VB +Me.radSpreadsheet.IsAIEnabled = True +``` + +Once enabled, you can show or hide the AI panel using the `IsAIPanelVisible` property. + +#### __[C#] Controlling AI panel visibility__ +```C# +// Show the AI panel +this.radSpreadsheet.IsAIPanelVisible = true; +``` + +#### __[VB.NET] Controlling AI panel visibility__ +```VB +' Show the AI panel +Me.radSpreadsheet.IsAIPanelVisible = True +``` + +Alternatively, you can use the `ToggleAIPanelCommand` to toggle the panel visibility. This command is useful for binding to buttons or other UI elements. + +#### __[XAML] Using ToggleAIPanelCommand__ +```XAML +