Skip to content

Microsoft Copilot Studio

Copilot Studio Easiest Way To Upload A File In A Chat Window

Copilot Studio Easiest Way To Upload A File In A Chat Window Posted by - Matthew Devaney on - June 15, 2025 19 Comments In Copilot Studio you can upload a fi...

Matthew Devaney
Published
Reading time
5 min read

Before you start

Is this guide for you?

Best entry point
Microsoft Copilot Studio
Time investment
5 min read

Imported reference from Matthew Devaney's blog for learning purposes. Original: https://www.matthewdevaney.com/copilot-studio-upload-file-to-chat-window-in-ms-teams/. Author: Matthew Devaney.

Copilot Studio Easiest Way To Upload A File In A Chat Window Posted by - Matthew Devaney on - June 15, 2025 19 Comments

In Copilot Studio you can upload a file to a chat window and then perform actions on it like run a prompt or save the file to SharePoint. This method shows how to upload a file by using a question node. We will also perform additional validation to ensure the correct file type was uploaded. Then the Agent can be deployed to MS Teams, M365 Copilot, SharePoint, etc. Table of Contents

Introduction: The Request For Proposal Agent

Add A New Topic To The Copilot Studio Agent

Upload A File To The Copilot Studio Agent Chat Window

Validate The File Type And Number Of Files

Run A Prompt Action With The Uploaded File As An Input Display The Prompt Output To The User

Video: Copilot Studio Easiest Way To Upload Files To A Chat Window

Introduction: The Request For Proposal Agent

Employees at a construction firm use the Request For Proposal Agent to get important details from an RFP. The employee can open the Copilot Studio Agent, upload the file to a Teams chat window and the Agent will return all project related deadlines.

Add A New Topic To The Copilot Studio Agent

Open Copilot Studio and create a new Agent named File Upload Agent . Use this text in the Agent description.

The Agent will receive a file from the user in the chat window and perform actions on it.

Then go to the Topics tab and add a new Topic from blank named Upload A File To Copilot Studio (Teams) .

We want the topic to trigger when the User asks to “analyze an RFP.”

Use this text to describe what the topic does.

This topic will analyze a request for proposal, also known as an RFP, and extract key information, such as deadlines.

Upload A File To The Copilot Studio Agent Chat Window

We want the Copilot Studio Agent to ask the User to upload and then verify that a file was attached to the User’s response. To do this, add a Question node to Copilot Studio that identifies a File type entity.

Validate The File Type And Number Of Files

For the Agent to operate properly we must ensure that a PDF file was uploaded in the chat, and that multiple PDF files are not present. To do this we create two new variables: isFileExtensionPdf and isFileCountEqualToOne .

Use this code to set the variable value isFileExtensionPdf and check if the filename ends in pdf. EndsWith ( Lower ( First ( System .Activity .Attachments ) .Name ), " .pdf " ) Code language: CSS ( css )

And use this code to set the variable value for isFileCountEqualToOne to determine if only one file was uploaded

CountRows(System.Activity.Attachments)=1

After setting the file validation variables add these two conditional branches to the topic and setup the all other conditions branch like this:

Condition: isFileExtension equal to false

Message node: “The uploaded file is not a valid pdf. Please try again.”

Go to step node: go back to the question node. Condition: isFileCountEqualToOne

Message node: “Multiple files were uploaded. Please try again and only upload one file.”

Go to step node: go back to the question node. All other conditions

Message node “PDF file received. I am reading the request for proposal right now. One moment please”

Run A Prompt Action With The Uploaded File As An Input

The Agent will analyze a PDF file uploaded to the chat window and return all project deadlines from it. We will run a prompt action to determine the deadlines and return the output to the Agent.

Go to Add A Tool and select New Prompt .

Name the prompt Get Project Deadlines From A PDF .

Then copy and paste the instructions below into the prompt designer and add RFP document as a document type input .

Objective: Your goal is to read a request for proposal document and identify all project related deadlines.

Instructions: 1. Read the entire request for proposal document and identify all deadlines 2. Determine what items must be delivered for each deadline 3. Output all deadlines in a bulleted list. Do not include any other text.

Output format: deadline date e.g. yyyy-mm-dd – deadline items

Prompt Inputs: RFP Document: [RPF Document]

Test the prompt. The prompt output should look like this. Save and close the prompt designer. Display The Prompt Output To The User

The final step is to display the text output by the prompt to the User. Add a message node to the topic with the promptOutput variable in the message body.

Save the topic, publish the Agent, then test the file upload. The Agent will now ask for the user to upload a file and send a list of project deadlines in the response message.

Video: Copilot Studio Easiest Way To Upload Files To A Chat Window

You can watch this step-by-step tutorial to learn how to upload a file through the chat window in Copilot Studio. And I’ll even teach you a 2nd method to upload a file without any question node! Did You Enjoy This Article? 😺

Subscribe to get new Copilot Studio articles sent to your inbox each week for FREE Enter your email address Sign Me Up Questions?

If you have any questions or feedback about Copilot Studio: Upload File To Chat Window In MS Teams please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion. Matthew Devaney Copilot Studio Video

Video: Copilot Studio – Add Human Review to Your AI Agents

Share this

Tagged

Microsoft Copilot Studio

Have a Microsoft 365 topic idea?

Share article suggestions, community session ideas, corrections, or real-world scenarios for future nextM365 learning notes.

Suggest a topic

Keep learning Microsoft 365

Explore more practical guides for SharePoint, Power Platform, Copilot Studio, migration, automation, governance, and security.

Continue learning

Next action

What to do next

Browse all tutorials →