Power Up - Upskill Yourself...

Reading view

Streamlining SharePoint File Analysis with Microsoft Copilot Studio Code Interpreter

Copilot StudioOrganizations today store massive volumes of structured data sales figures, inventory records, and financial reports in Excel and CSV files across SharePoint libraries. When someone needs a quick insight from that data, the typical path involves downloading the file, opening it in Excel or Power BI, writing formulas or building visuals, and then sharing the result. It works, but it’s slow, manual, and requires a level of technical skill that not every team member has.

What if there was a way to simply ask a question and get the answer complete with accurate calculations and even a chart without ever leaving a chat window.

That’s the promise of Code Interpreter in Microsoft Copilot Studio. This preview feature allows Copilot Studio agents to go beyond simple Q&A by dynamically generating and executing Python code to analyze structured data files. When paired with a SharePoint Document Library as a knowledge source, it creates a powerful self-service analytics experience: users ask questions in plain English and the agent does the heavy lifting searching SharePoint for the right file, writing the code, running the computation, and delivering the result.

In this blog, we’ll explore what Code Interpreter is, how it works with SharePoint, and see it in action.

Code Interpreter is a capability within Microsoft Copilot Studio that enables AI agents to generate and execute Python code on the fly in response to user queries. Rather than relying solely on the large language model’s inherent reasoning which can be unreliable for math and data-heavy questions Code Interpreter offloads analytical tasks to deterministic Python computations.

The agent doesn’t estimate the answer. Instead, it writes a precise Python script, runs it against the actual data, and returns the calculated result. The math is real. The answer is accurate. And the user never sees a single line of code unless they choose to.

You can enable code interpret in the agent setting in Generative AI, scrolling down you will find the option for code interpreter and enable that.Copilot Studio

There are two ways to feed structured data into a Copilot Studio agent for analysis. The first is user-uploaded files where someone attaches a CSV or Excel file directly in the chat. The second, and more enterprise-relevant approach, is connecting a SharePoint Document Library as a knowledge source. In this blog, we focus on the SharePoint approach.

When a user asks an analytical question, the agent follows a multi-step process behind the scenes:

  1. Understand the query: The orchestrator interprets the natural language question and determines it requires data analysis.
  2. Search SharePoint: The agent uses Work IQ Microsoft’s enhanced retrieval layer to search the connected SharePoint knowledge source and locate the relevant structured file.
  3. Retrieve and inspect: The agent retrieves the file content and examines its structure columns, data types, and rows.
  4. Generate Python code. Based on the query and the data, the agent writes a Python script tailored to answer the question.
  5. Return the result. The output a table, a chart, a number, or a summary is delivered back to the user in the chat.

To demonstrate this capability, we have two structured datasets stored in a SharePoint Document Library SalesReport.xlsx containing employee-level sales performance data, and BusinessSalesAnalysis.xlsx containing order-level business data with products, categories, regions, and revenue.

Copilot Studio

With Code Interpreter enabled and the SharePoint files connected as a knowledge source, the agent can now answer analytical questions directly. Let’s see how it responds to a couple of queries.

Below are some of the question asked to the agent.

Query 1: “Which product category generated the highest revenue in the uploaded Excel report?”

The agent identified the relevant file, executed Python code to calculate revenue by product category, and returned a clear breakdown Electronics leading at $738,000 followed by Furniture at $517,000. It even highlighted key revenue drivers like Laptops and Monitors.

Copilot Studio

Query 2:  Analyze the uploaded sales dataset and provide a summary of overall business performance.

This time, the agent analyzed both datasets together and returned a comprehensive summary $1,255,000 in total revenue, $286,000 in profit, 321 units sold, and a 22.79% profit margin. It also generated a month-over-month revenue and profit trend table from January through May.

Copilot Studio

As you can see, the agent has used the Code Interpreter to answer the user’s queries generating Python code behind the scenes, running real calculations against the SharePoint data, and returning accurate, formatted results directly in the conversation. No manual data work. No formulas. Just a natural language question and a precise answer.

Conclusion

Code Interpreter in Microsoft Copilot Studio brings real computational power to the conversational AI experience. By combining natural language understanding with deterministic Python execution and grounding it in the structured files already living in SharePoint it creates a genuinely useful self-service analytics layer. Users ask questions in plain language. The agent finds the data, writes the code, runs the computation, and delivers the answer all within seconds.

FAQs

What is Code Interpreter in Microsoft Copilot Studio?

Code Interpreter is a capability in Microsoft Copilot Studio that enables AI agents to generate and execute Python code automatically. It allows agents to perform data analysis, calculations, visualizations, and file processing based on user queries, delivering accurate results directly within a conversation.

How does Code Interpreter work with SharePoint files?

When SharePoint Document Libraries are connected as a knowledge source, the Copilot Studio agent can locate relevant Excel or CSV files, analyze their contents, generate Python code to answer user questions, execute the code, and return insights such as summaries, calculations, tables, or charts.

Can Microsoft Copilot Studio analyze Excel files stored in SharePoint?

Yes. Microsoft Copilot Studio can analyze Excel files stored in SharePoint when the library is configured as a knowledge source and Code Interpreter is enabled. Users can ask questions in natural language, and the agent retrieves and analyzes the data automatically.

What types of files can Code Interpreter analyze?

Code Interpreter primarily supports structured data files such as Excel (.xlsx) and CSV (.csv) files. These files can be uploaded directly by users or accessed through connected SharePoint Document Libraries.

Why is Code Interpreter more accurate for data analysis?

Unlike traditional AI responses that rely on probabilistic reasoning, Code Interpreter generates and executes actual Python code against the source data. This ensures calculations, aggregations, and analytical results are based on real data processing rather than estimation.

The post Streamlining SharePoint File Analysis with Microsoft Copilot Studio Code Interpreter first appeared on Microsoft Dynamics 365 CRM Tips and Tricks.

Automating Training Request Approvals Using AI in Microsoft Copilot Studio

Training Request Approval Organizations frequently receive employee requests for training programs, certifications, or skill-development courses. Traditionally, these requests go through manual review and approval processes which can delay decision making and create administrative overhead.

With Advanced Approvals in Microsoft Copilot Studio, it is possible to automate such decisions using AI. Instead of relying on human approval stages, AI can evaluate the request details and decide whether the request should be approved or rejected based on predefined criteria.

In this article, we will build a Training Request Approval System where:

  • A user creates a training request record in Dataverse
  • An AI approval stage evaluates the request
  • The AI automatically approves or rejects the request

This implementation demonstrates how AI-driven approvals can automate business decisions without human intervention.

Prerequisites

Before starting, ensure the following are available:

  • Access to Microsoft Copilot Studio
  • A Power Platform environment with Dataverse enabled
  • Basic knowledge of Dataverse tables and Copilot Studio agent flows

Solution Overview

The workflow implemented in this article follows a simple structure.

  1. Employee submits a training request
  2. The request is stored in Dataverse
  3. AI evaluates the request
  4. The system updates the approval status

This removes the need for manual manager approvals and allows faster decision making.

Step 1: Create a Dataverse Table for Training Requests

First, create a Dataverse table that will store the training requests.

Example table: Training Requests

Suggested columns:

Column Name Type
Employee Name Text
Course Name Text
Training Provider Text
Cost Currency
Training Date Date
Approval Status Choice (Pending, Approved, Rejected)

This table will be used by the AI flow to read and update request details.

Step 2: Create an Agent Flow in Copilot Studio

Navigate to Copilot Studio → Agent Flows and create a new flow.

Agent flows allow you to automate processes using AI and actions connected to data sources like Dataverse.

In this implementation, the agent flow will:

  • Retrieve the training request
  • Evaluate the request using AI
  • Update the request status.

Training Request Approval
Agent Flow creation screen in Copilot Studio

Step 3: Configure the Multistage Approval Step

Add the Run a multistage approval action in the flow.

This feature allows AI to evaluate requests based on specific instructions.

Since this implementation focuses on AI-only approval, no manual stages are added.

The flow will only contain the Evaluate Request AI stage.

Training Request Approval Run a multistage approval (preview) configuration screen

Step 4: Define AI Evaluation Instructions

Inside the Evaluate Request step, define clear instructions for the AI model so it knows how to evaluate the request.

Example instructions:

Evaluate the employee training request and decide whether it should be Approved or Rejected.

APPROVE the request if ALL of the following are true :

– The trainingCost <= 1000.00

– trainingStartDate is after the date the course is purchased (i.e. coursePurchaseDate)

– The request contains all required details including employeeName, courseName, trainingCost, and trainingStartDate.

REJECT the request if any of the above are false.

Note: Here trainingCost, trainingStartDate, employeeName, courseName, coursePurchaseDate are dynamic fields as shown below in the image

These instructions guide the AI model to consistently evaluate each training request.

Automating Training Request Approvals Using AI in Microsoft Copilot StudioAI instruction configuration inside the Evaluate Request stage

Step 5: Update the Dataverse Record

After the AI evaluates the request, configure the next step in the flow to update the Dataverse record.

Based on the AI decision:

  • If Approved → Update Approval Status to Approved
  • If Rejected → Update Approval Status to Rejected

This ensures the final decision is stored directly in Dataverse.

Training Request Approval
Dataverse Update Row action in the flow

Testing the AI Approval Process

Once the flow is configured:

  1. Create a new training request record
  2. Trigger the agent flow
  3. Observe the AI evaluation
  4. Verify that the Approval Status updates automatically

This demonstrates how AI can independently make approval decisions based on defined rules.

Training Request Approval Dataverse Update Row action flow when all conditions are met / true

Training Request Approval
Dataverse Update Row action flow when all conditions are not met / false

Training Request Approval
Example training request record before and after AI evaluation

Challenges You May Encounter

While implementing AI approvals in Copilot Studio, you may encounter some configuration challenges.

1.Writing Effective AI Instructions

The AI model relies heavily on the instructions provided. If instructions are vague, the decision may be inconsistent.

To avoid this:

  • Clearly define approval and rejection conditions
  • Keep the logic simple and structured.

2.Mapping Dataverse Fields

Incorrect field mapping between the agent flow and Dataverse may prevent the AI from reading request data correctly.

Always verify:

  • Column names
  • Data types
  • Input parameters passed to the AI stage.

3.Understanding AI Decision Outputs

The AI stage returns structured output which must be correctly interpreted when updating Dataverse records. Improper condition checks may cause incorrect status updates.

4.Preview Feature Limitations

The Multistage Approval feature is currently in preview, so some UI elements or configurations may change over time.

Benefits of AI-Driven Approvals

Implementing AI-based approvals provides several advantages:

  • Faster decision making
  • Reduced dependency on manual approvals
  • Scalable automation
  • Consistent evaluation logic
  • Seamless integration with Dataverse

Conclusion

Advanced approvals in Microsoft Copilot Studio open new possibilities for automating decision-based workflows. In this example, we built a Training Request Approval System where AI evaluates each request and determines whether it should be approved or rejected.

FAQs: Automating Training Request Approvals with AI in Microsoft Copilot Studio

  • What is AI-driven approval in Microsoft Copilot Studio?
    AI-driven approval in Microsoft Copilot Studio automates the decision-making process for requests, such as employee training requests. Instead of waiting for human manager approval, AI evaluates the request based on predefined rules and updates the approval status automatically in Dataverse.
  • How does the training request approval system work?
    The system works in a few steps:
  1. An employee submits a training request in Dataverse.
  2. The AI agent flow in Copilot Studio retrieves the request.
  3. The AI evaluates the request against predefined approval criteria.
  4. The AI updates the request status as Approved or Rejected.
  • What are the prerequisites for setting up AI approval in Copilot Studio?
    To implement AI-based training approvals, you need:
  1. Access to Microsoft Copilot Studio.
  2. A Power Platform environment with Dataverse enabled.
  3. Basic knowledge of Dataverse tables and Copilot Studio agent flows.
  • Can AI completely replace human approval for training requests?
    Yes, AI can handle approval entirely if the evaluation logic is clearly defined. AI ensures faster, consistent, and scalable approvals, reducing administrative overhead. However, organizations can still add manual review stages if needed.

The post Automating Training Request Approvals Using AI in Microsoft Copilot Studio first appeared on Microsoft Dynamics 365 CRM Tips and Tricks.

How Copilot Studio Leverages Deep Reasoning for Intelligent Support Operations

CopilotStudio

Deep Reasoning in Microsoft Copilot Studio enables AI agents to analyze multi-step support scenarios, evaluate historical case data, apply business rules, and recommend well-reasoned actions similar to how an experienced support specialist thinks.

AI agents are becoming a core part of customer service operations, but traditional conversational models often struggle when scenarios become complex, like diagnosing a multi-step issue, understanding multi-turn case histories, or recommending the next best action.
Microsoft’s new Deep Reasoning capability in Copilot Studio (currently in preview) bridges this gap by enabling agents to think more logically and deliver more accurate conclusions.

This feature equips Copilot agents with advanced analytical abilities similar to how a skilled support specialist breaks down a problem, evaluates evidence, and suggests well-reasoned actions.

How Deep Reasoning Works

Deep reasoning is powered by an advanced Azure OpenAI model (o3), optimized for:

  • Multi-step thinking
  • Logical deduction
  • Complex problem solving
  • Chain-of-thought analysis
  • Context comprehension across long conversations

When enabled, the agent automatically decides when to invoke the deep reasoning model, especially during:

  • Complicated queries
  • Multi-turn conversations
  • Tasks requiring decision making
  • Summaries of large case files
  • Applying business rules

Alternatively, you can instruct the agent to explicitly use deep reasoning by including the keyword “reason” in your agent instructions.

Business Use Case:

Imagine a company that manages thousands of service cases, technical issues, warranty requests, customer complaints, and product inquiries.
Handling these efficiently requires deep understanding of:

  • Historical case data
  • Case descriptions across multiple interactions
  • Dependencies (products, warranties, previous repairs, SLAs)
  • Business rules
  • Customer communication patterns

A standard AI model can answer simple questions, but when a customer or sales representative asks something like:

  • Why was this customer’s case reopened three times?
  • Given the reported symptoms and past activity, what should be the next troubleshooting step?
  • Which SLA should be applied in this situation, and what is the reasoning behind it?
  • Considering the notes from all three departments, what appears to be the underlying root cause?

Your agent needs more than a direct lookup.
It needs reasoning.

This is where Deep Reasoning dramatically improves the experience.

How to Enable Deep Reasoning in Copilot Studio (Step-by-Step)

Setting up deep reasoning in a Copilot Studio agent is straightforward:

Step 1. Enable generative orchestration

This allows the agent to decide intelligently which model should handle each part of the conversation.

Step 2. Turn on Deep Reasoning

When enabled, the o3 model is added to the agent’s orchestration pipeline.

CopilotStudio

Step 3. Add the reason keyword (optional but recommended)

Inside the Agent Instructions, specify where deep reasoning should be applied:

As mentioned in the screenshot below, the word “reason” is used twice to trigger deep reasoning in our custom agent.

CopilotStudio

Step 4. Connect data sources

You can link multiple sources such as:

  • Dataverse Cases table
  • Knowledge bases
  • SharePoint documents
  • Product manuals
  • Troubleshooting guides

Deep reasoning enables the agent to interpret and analyze these materials more effectively.
For this example, I connected a Dataverse MCP server to provide the agent with improved access to Dataverse tables.

CopilotStudio

Step 5. Test complex scenarios

Ask real-world questions like:

  • Analyze the case history and determine the most likely root cause.
  • Based on the customer’s issue description, what steps should the technician take next?
  • Explain why this case breached SLA.

You will notice the agent provides a structured, logical answer rather than surface-level information.

CopilotStudio

You can also verify that deep reasoning was activated by checking the Activity section.

CopilotStudio

Frequently Asked Questions About Deep Reasoning in Copilot Studio

What model powers Deep Reasoning in Copilot Studio?
Deep Reasoning is powered by the Azure OpenAI o3 reasoning model, optimized for multi-step analysis and logical deduction.

When should Deep Reasoning be used?
It should be applied to complex, multi-turn conversations involving business rules, SLAs, historical data, or decision-making.

Does Deep Reasoning replace standard Copilot responses?
No. Copilot Studio dynamically decides when Deep Reasoning is required, using standard models for simpler interactions.

Can Deep Reasoning analyze large case histories?
Yes. It is specifically designed to interpret long conversations and large volumes of contextual data.

Conclusion

By connecting rich data sources and enabling deep reasoning, the agent becomes significantly more capable of understanding complex case scenarios and providing meaningful, actionable responses. When tested with real-world questions, the agent demonstrates structured analysis, logical decision-making, and deeper insights rather than surface-level replies.

This ensures more accurate case resolutions, improved productivity, and a smarter, more reliable support experience.

The post How Copilot Studio Leverages Deep Reasoning for Intelligent Support Operations first appeared on Microsoft Dynamics 365 CRM Tips and Tricks.

❌