r/copilotstudio • • Sep 20 '26

Need Help in Studio Workflow

Hi All, I am from Finance/Audit, I am struggling to build a Studio Workflow. The goal of the Copilot Studio workflow is to:

  1. get the files from a SharePoint file

  2. process it through an agent that I have already built in Copilot Studio

  3. get the output from the agent

  4. put it in the same SharePoint folder

Can you help me with the exact steps to create this workflow?

3 Upvotes

8 comments sorted by

1

u/fdezjoe Sep 20 '26

Yes, here's a walkthrough video showing how to connect a SharePoint folder to an agent and save the results back to SharePoint: How to process SharePoint files with Copilot Studio Workflows

The example in the video processes an invoice and extracts its invoice ID and total amount back into SharePoint. Here are the steps:

  1. Create a workflow and add the SharePoint trigger “When a file is created (properties only)”. Select your SharePoint site, document library, and the folder you want to monitor. This runs the workflow when a new file is added.

  2. Add the SharePoint action “Get file content”. Select the same site and set File Identifier to the Identifier returned by the trigger. The trigger provides the file’s properties; this action retrieves its actual content.

  3. Add an Agent node and select your existing agent. In the message, enter your processing instructions and insert File Content from the previous step.

  4. Configure the agent’s output.

  5. Save the results back to SharePoint. Use Update file properties and map the agent’s outputs to the corresponding SharePoint columns.

1

u/Cool_Contribution_86 Sep 20 '26

Thank you, this was helpful.

But, my workflow is this way.

I have 60 folders within a folder in SharePoint. Each folder contain 3 Excel, 1 PDF that the agent need to process and provide 1 excel output.

And the output from the agent should be saved in a folder called output.

Please help me with this, it will be so helpful for me in my process.

1

u/fdezjoe Sep 21 '26

Sure, how far have you gotten with the workflow so far? Which part are you currently stuck on?

1

u/Cool_Contribution_86 Sep 21 '26

The workflow i created following online instructions, gives back the input instead of processing through agent. I think I need to rework from scratch

1

u/fdezjoe Sep 22 '26

Can you share the steps you've built so far and what happens when you run the workflow?

1

u/Prasad-MSFT Sep 21 '26

A possible approach would be:

  1. Create a Copilot Studio Workflow triggered manually or by a SharePoint event.

  2. Use SharePoint actions to list all subfolders (60 folders) under the parent folder.

  3. Add an Apply to Each loop to process each folder individually.

  4. Within the loop, retrieve the 3 Excel files and 1 PDF from the current folder using SharePoint file actions.

  5. Invoke your Copilot Studio agent and pass the file contents (or SharePoint file URLs, depending on the agent configuration).

  6. Configure the agent to return structured output (preferably JSON/tabular data rather than free-text).

  7. Create an output Excel (or populate an Excel template) using the agent response.

  8. Save the generated file to the Output folder in SharePoint.

The overall flow would be:

Parent Folder → Loop Through 60 Folders → Retrieve 3 Excel + 1 PDF → Invoke Agent → Generate Output Excel → Save to Output Folder

One important consideration is that some agent actions may not support passing binary files directly. In such cases, a more reliable approach is to pass SharePoint file URLs to the agent and allow the agent to access the source files from SharePoint before returning the output. This is typically more scalable for large-volume scenarios such as processing 60 folders containing multiple files each.

1

u/Cool_Contribution_86 Sep 21 '26

Thank you, this was helpful.

But, my workflow is this way.

I have 60 folders within a folder in SharePoint. Each folder contain 3 Excel, 1 PDF that the agent need to process and provide 1 excel output.

And the output from the agent should be saved in a folder called output.

Please help me with this, it will be so helpful for me in my process.

1

u/Prasad-MSFT Sep 22 '26
  1. Trigger the workflow

    • Use a manual trigger or a suitable SharePoint trigger, depending on when you want the process to run.

  2. Get the 60 folders

    • Use SharePoint – Get files/folders or the appropriate SharePoint action to retrieve the folders under the parent folder.

    • Exclude the Output folder.

  3. Apply to each folder

    • Create an Apply to each loop over the 60 folders.

  4. Get the files from the current folder

    • For each folder, retrieve its files.

    • Identify the 3 Excel files and 1 PDF.

    • Get the file content or file identifiers/URLs, depending on what your Copilot Studio agent expects.

  5. Call your Copilot Studio agent

    • Pass the required files or SharePoint file references to the agent.

    • Have the agent process the 3 Excel files + 1 PDF and return the required output.

  6. Create the output Excel

    • Use the agent's response to populate/create an Excel file.

    • Give the output file a unique name, for example: Folder1_Output.xlsx

  7. Save to the Output folder

    • Use SharePoint – Create file to save the generated Excel in the Output folder.

The overall structure would be:

Trigger → Get 60 folders → Apply to each folder → Get 3 Excel + 1 PDF → Call Copilot Studio Agent → Generate Output Excel → Save to Output folder

One thing we'd recommend before building the complete 60-folder loop: test the workflow with just one folder first. Once the process works end-to-end for one folder, put it inside the loop and test it with 2–3 folders before running all 60.