Tuesday, 24 March 2026

{How to} use code interpreter on customer uploaded files in agent conversations in copilot studio

Hello Everyone,




Today I am going to share my thoughts on the use of the code interpreter on customer-uploaded files in agent conversations in copilot studio.






Let's get started.



Your chatbot (agent) can take a user upload during a chat and automatically analyze it using code, then return results within the same conversation.




What actually happens behind the scenes



1.  User uploads a file


Examples:

Excel (.xlsx)
CSV (.csv)
Sometimes JSON or text files.


2. The agent receives the file


The file is passed into the conversation as:

System.Activity.Attachments



3. Code Interpreter kicks in


Copilot Studio:

Generate Python code automatically

Runs it in a secure environment

Uses it to:
  • Read the file
  • Analyse data 
  • Create outputs




4. The agent responds with results


The bot sends back:

  • Charts
  • Tablets
  • Insights
  • Summaries

Example flow:







Real example

User says:

“Analyze this sales spreadsheet”

What the agent does:

  • Reads the Excel file
  • Groups sales by month
  • Calculates totals
  • Generates a chart

Response:

“Revenue increased 18% in Q3. Here’s a breakdown…” + chart


 

Why this feature is useful

  • No manual coding needed
  • Works in real-time conversations
  • Turns your agent into a data analyst
  • Great for:
    • Customer uploads
    • Business reports
    • Data exploration

 In one sentence

It lets your Copilot Studio agent act like a Python-powered data analyst that can read and analyze files users upload during chat.


Important notes

  • Best with structured data (Excel, CSV)
  • Requires:
    • File upload enabled
    • Code Interpreter enabled
  • Has file size and type limits




That's it for today.

I hope this helps.

Malla Reddy Gurram aka @UK365GUY



No comments:

Post a Comment

Note: only a member of this blog may post a comment.