Copilot Studio Gallery
ContributorsShare a sample
← Back to gallery

Agents + workflows

Built by Microsoft

Accountant Document Intake & Q&A

A workflow reads every invoice, spreadsheet, Word file or scanned PDF dropped in SharePoint and writes figures, reasoning and anomalies to Dataverse. A Q&A agent answers from that data through MCP, excluding duplicates and test rows from totals, and opens the source file only when needed.

ATby Adriana TrujilloVersion 1.01 downloadGitHub Release ZIP downloads across tracked versions since 2026-11-07. Last counted 2026-11-08T07:45:37.325Z. Includes direct downloads, repeats, and automation; not installations. As of 2026-11-08T07:45:37.325Z.Updated 2026-10-25Rate & discuss

This sample is provided as-is and is not covered by Microsoft Support. The underlying Copilot Studio and Power Platform products retain their standard support. Importing can create or modify resources and use your connections and permissions. Support details

Download ZIP
What’s in the solution
  • 1 workflow
  • 1 agent
  • 4 MCP servers
  • 3 skills

Workflow preview

Document Extraction

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Financefinanceaccounts-payabledocument-extractiondataversesharepointmcpskillshuman-in-the-loop

Accountants receive source documents in every format: Excel and CSV exports, native PDFs, scanned image PDFs, and Word letters. This sample removes the manual data entry. A workflow reads each new file once, thoroughly, and stores the figures plus the reasoning and anomalies behind them in Dataverse. A conversational agent then answers the accountant’s questions from that data and only opens the original file when the stored data can’t answer.

The design principle is “do the hard part once”: the workflow captures enough context per document (how each figure was derived, what looked unusual, whether the read was complete) that the agent rarely needs to re-read a source file.

What’s inside

Workflow

Document Extraction runs whenever a file is created in a SharePoint intake folder, whatever its type.

  1. Skip non-documents. Folders and Office lock files (~$…) end the run.
  2. Get file content from SharePoint.
  3. Extract with an inline agent that reads the actual content, including scanned and handwritten pages, with no separate OCR step. It returns a structured output: invoice number, invoice date, vendor, amount due, currency, an extraction status (Full / Partial), a transformation note (how each figure was derived or interpreted), an outliers note (anything a human should look at), and an isSourceDocument flag.
  4. Skip previous outputs. Reports, summaries, exports and reconciliations (isSourceDocument = false) end the run, so they never become rows.
  5. Create a row in the Accounting Dataverse table, adding the source file name and an ingestion timestamp so every row traces back to its document.

A document that is only partly readable is never discarded. It is written with status Partial and the reason in the notes. There is no per-file email; the table is the live source of truth.

Agent

Accountant Q&A Assistant is the accountant’s single conversational interface. It knows only the table name, Accounting. It discovers the columns at runtime, so you can change the table without rewriting the agent.

SkillWhat it does
query-accounting-dataUsed first for nearly every question. Discovers the schema, maps the question to columns, runs read-only SQL (filter, sort, group, sum), and shows the workflow’s notes next to the figures. For calculations it deliberately excludes rows marked as test data and extra copies of duplicate documents, treats credit notes separately (never as amounts owed), and always says what was left out and how much it would change the result. The accountant can ask to include everything.
ad-hoc-source-document-analysisThe fallback when the table can’t answer. Finds the file (using the source file name stored on the row), reads PDF, scanned PDF, Word and Excel/CSV content, verifies or challenges a stored figure, reconciles documents, and cites the page, sheet or section. Asks one focused clarifying question at most.
write-back-changesThe only skill that changes anything. Corrects or adds rows and saves analyses to SharePoint, but only when the accountant explicitly asks. It shows exactly what will be written and waits for a “yes”.

The agent connects to data through two MCP servers, each split into a read tool and a write tool:

ToolMCP serverTools enabledApproval
Accounting data (Dataverse MCP) - readDataversesearch, describe, read_query (plus older names list_tables, describe_table, fetch)None
Accounting data (Dataverse MCP) - create and updateDataversecreate_record, update_recordEvery call
Source documents (SharePoint MCP) - readSharePointgetFileOrFolderMetadataByUrl, getSiteByPath, listDocumentLibrariesInSite, getDefaultDocumentLibraryInSite, getFolderChildren, findFileOrFolder, getFileOrFolderMetadata, readSmallTextFile, readSmallBinaryFileNone
Source documents (SharePoint MCP) - save filesSharePointcreateFolder, createSmallTextFile, createSmallBinaryFileEvery call

No delete tools are enabled. Deleting records, files, tables or columns, and changing table structure, is not possible from the agent.

Dataverse table

The solution includes the Accounting table (cr900_accounting) that the workflow writes to:

ColumnLogical nameTypeNotes
Vendor Namecr900_vendornameText (850)Primary column. Unknown when it can’t be determined.
Invoice Numbercr900_invoicenumberText (100)
Invoice Datecr900_invoicedateDate only
Amount Duecr900_amountdueDecimal
Currencycr900_currencyText (100)ISO code, e.g. GBP, EUR, USD
Extraction Statuscr900_extractionstatusChoice1 = Full, 2 = Partial
Transformation Notecr900_transformationnoteMultiline text (8,000)How figures were derived or interpreted
Outliers Notecr900_outliersnoteMultiline text (8,000)Anything unusual worth a human’s attention
Source File Namecr900_sourcefilenameText (100)Name of the original file
Ingestion Timestampcr900_ingestiontimestampDate and timeWhen the row was written

All business columns except the vendor name are optional, because not every document contains every field.

Before you start

  • A Power Platform environment with Dataverse and Copilot Studio, with the new Copilot Studio experience turned on. A First Release or Early Release environment is preferred.
  • Permission to import solutions and create connections in that environment.
  • A SharePoint document library with an intake folder for source documents. The sample uses library Shared Documents and folder Monthly Docs.
  • Dataverse MCP enabled for Copilot Studio. In the Power Platform admin center, open the environment and allow Copilot Studio as a Dataverse MCP client. Dataverse MCP calls are billed; check your licensing before rollout.
  • The SharePoint MCP server connector must be allowed by your data policies.
  • Users of the agent need a security role with read access to the Accounting table, and create and write access if they will use the write-back skill. The agent’s tools run as the signed-in user.

Set it up (recreate the sample as-is)

1. Prepare SharePoint

Create (or choose) a SharePoint site and library, and add an intake folder, for example Shared Documents / Monthly Docs. Make sure the people who will use the agent can read it.

2. Import the solution

Download the solution ZIP from this page and import it through Solutions → Import solution. Create or select connections for:

Connection referenceConnectorUsed by
new_sharedsharepointonline_f336d932 and new_sharedsharepointonline_c6307d22SharePointWorkflow trigger and Get file content
new_sharedagentnode_423b8AgentsWorkflow Extract step
new_sharedcommondataserviceforapps_affedMicrosoft DataverseWorkflow Create row and the agent’s Dataverse MCP tools
new_sharedworkiqsharepoint_b9b7aSharePoint MCPThe agent’s SharePoint MCP tools

The import creates the Accounting table, the Document Extraction workflow and the Accountant Q&A Assistant agent.

3. Point the workflow at your folder

Open Document Extraction and select the trigger When a file is created (properties only). The site in the sample is a placeholder (https://contoso.sharepoint.com/sites/AccountsIntake). Select your Site address, Library name and Folder. Then open the Get file content step and select the same Site address. Save and turn on the workflow.

4. Point the agent at your folder

The agent needs to know where the source documents live. Replace https://contoso.sharepoint.com/sites/AccountsIntake (and the library or folder name, if yours differ) in these three places:

WhereWhat to change
Agent Instructions, section Where the data livesSite URL, library and intake folder
Skill ad-hoc-source-document-analysis, Intake location and the getFileOrFolderMetadataByUrl exampleSite URL, library and folder path
Skill write-back-changes, LocationThe intake folder name, if you renamed it (analyses are saved to a sibling folder, Accountant Analyses, so the workflow doesn’t pick them up as new documents)

5. Check the MCP tools

Open the agent’s Tools. Each MCP tool should show its connection and the enabled tools listed in Agent. If a tool lost its connection on import, select it and pick your connection. If a tool is missing, add it again through Tools → Add a tool → Model Context Protocol, choose Dataverse or SharePoint, then turn on only the tools in the table above and set the create, update and save tools to require approval.

6. Test and publish

Drop a few documents in the intake folder, wait for the rows to appear in the Accounting table, then open the agent in Preview. When you’re happy, Publish it.

Tailor it

The workflow owns the structure; the agent adapts. Use this table to see what to change, and where, for common adjustments.

You want to…Change in the workflowChange in DataverseChange in the agent
Capture a new field (e.g. due date, VAT, PO number, document type)Add the property to the Extract step’s output schema, with a clear description, and map it in Create rowAdd the column to AccountingNothing. The schema is discovered at runtime.
Remove a fieldRemove it from the output schema and the Create row mappingDelete the columnNothing
Rename the tableUpdate the Create row stepRename the tableReplace “Accounting” in the instructions and in the query-accounting-data skill (Step 1)
Change the extraction status valuesKeep the output schema enum values in step with the choice valuesEdit the Extraction Status choiceNothing (labels are read from the schema)
Watch a different folder or libraryTrigger and Get file content step—Instructions and ad-hoc-source-document-analysis (see step 4 above)
Skip other kinds of filesExtend the first condition (e.g. by extension) or tighten the isSourceDocument description——
Store credit notes as negative amountsTell the extractor in the amountDue description to return credits as negative numbers, or add a document-type fieldOptional document-type columnNothing. The agent already recognises credit notes from the amount, number, file name or notes.
Change how totals are calculated——query-accounting-data, Step 3b - Clean the calculation set (test data, duplicates, credit notes)
Allow or restrict writes—Security roles on the tableThe MCP tools’ enabled tools and approval setting, and the write-back-changes skill
Use a different modelThe Extract step’s model—The agent’s model setting

When you change the extractor, keep every field optional and keep the two notes. The notes are what let the agent explain a figure without reopening the file.

Try it

Drop a mix of documents in the intake folder: a native PDF invoice, a scanned or handwritten invoice, a Word letter, an Excel or CSV export, a resent copy of an invoice, a credit note, and a file that isn’t a financial document. Then ask the agent:

  1. What’s the total amount due, by currency?

    Expect totals per currency, never converted or combined, followed by a Not included in this calculation list: duplicate copies counted once, rows marked as test data left out, and credit notes shown as credits with a separate net figure, each with its impact on the total.

  2. How much do we owe <vendor>, and is anything wrong?

    Expect the amount, with duplicates and anomalies (unusual amounts, placeholder bank details, handwritten changes) quoted from the workflow’s notes.

  3. Which invoices are dated in October 2026, earliest first?

    Expect each document once, with dates read correctly from every format (US, European and written-out dates).

  4. For the <vendor> invoice, what was the original printed total before the handwritten change?

    Expect an answer from the stored notes, then an offer to open the scan to verify it; accepting it runs the source-document skill.

  5. Delete the <vendor> record and its file.

    Expect a refusal: deletion is disabled, so the data owner must do it.

Notes

  • The agent reads files through the SharePoint MCP server, which is limited to files up to about 5 MB. Scanned PDFs are read by extracting the page image in the agent’s code sandbox; expect a few minutes per document. The agent says so plainly when it can’t read a file and gives you the link instead.
  • Citations in answers can show raw query output, including internal column names.
  • The workflow processes each new file independently. Duplicates and out-of-range amounts are flagged by the extractor from the document itself; the agent’s duplicate rules catch the rest when calculating.
  • Clear out test rows before go-live. The agent excludes rows that are clearly marked as test data, but it can’t delete them.

Agents and their components

The MCP servers, tools, and skills each agent uses, and which agents hand off to others. Hover a component for its description.

AgentMCP serversSkills

Accountant Q&A Assistant

Agent

  • Accounting data (Dataverse MCP) - create and update
  • Accounting data (Dataverse MCP) - read
  • Source documents (SharePoint MCP) - read
  • Source documents (SharePoint MCP) - save files
  • ad-hoc-source-document-analysis
  • query-accounting-data
  • write-back-changes

Workflows and their components

Triggers, steps, connector services, and agent calls in each workflow.

WorkflowTriggerConnectorsAgents

Document Extraction

8 steps

When a file is created (properties only)

Connector · SharePoint

  • Microsoft Dataverse
  • SharePoint
—No agent calls

Exploded solution manifest

The download rebuilds these submitted files at the ZIP root. Gallery metadata and the human-facing README are excluded.

Solution
AccountantDocumentIntake
Publisher
CDS Default Publisher
Version
1.0
Files
21
component: 14bot: 2other: 2solution: 2workflow: 1
PathTypeSize
[Content_Types].xmlother1,367 B
Assets/botcomponent_connectionreferenceset.xmlother1,335 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.ad-hoc-source-document-analysis_LVp/botcomponent.xmlcomponent1,115 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.ad-hoc-source-document-analysis_LVp/datacomponent9,364 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.query-accounting-data/botcomponent.xmlcomponent376 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.query-accounting-data/datacomponent11,754 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.write-back-changes/botcomponent.xmlcomponent370 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.skill.write-back-changes/datacomponent5,029 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.accounting-dataverse-read_DhK6sx/botcomponent.xmlcomponent743 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.accounting-dataverse-read_DhK6sx/datacomponent296 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.accounting-dataverse-write_8hQZ7Y/botcomponent.xmlcomponent753 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.accounting-dataverse-write_8hQZ7Y/datacomponent293 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.source-documents-sharepoint-read_VUOd8X/botcomponent.xmlcomponent715 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.source-documents-sharepoint-read_VUOd8X/datacomponent449 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.source-documents-sharepoint-save_wTS08x/botcomponent.xmlcomponent767 B
botcomponents/Default_Accountant_QA_Assistant_1ac50a.tool.source-documents-sharepoint-save_wTS08x/datacomponent325 B
bots/Default_Accountant_QA_Assistant_1ac50a/bot.xmlbot383 B
bots/Default_Accountant_QA_Assistant_1ac50a/configuration.jsonbot4,836 B
customizations.xmlsolution101,067 B
solution.xmlsolution4,211 B
Workflows/DocumentExtraction-EC16F4A6-D161-C9EE-4774-E93A104070A9.jsonworkflow128,379 B

Rate & discuss

Found this solution useful? Give it a thumbs up, ask a question, or share what you built.

GitHub Discussions ↗

Sign in with GitHub to join the conversation. Your comments and reactions are public.

Loading discussion...

This sample is provided as-is and is not covered by Microsoft Support. The underlying Copilot Studio and Power Platform products retain their standard support. Importing can create or modify resources and use your connections and permissions. Support details

Download ZIP

Explore community-built apps, agents, and workflows before you install.

Third-party noticesView on GitHub