Google Drive Receipt OCR to Expense Log
When a receipt image or PDF is added to a Google Drive folder, the flow runs OCR/Document Intelligence to extract vendor, date, and total, appends a row to an expense Dataverse table, files the receipt in a dated SharePoint folder, and notifies finance. Turns dropped receipts into structured expense records.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow turns receipts dropped into a Google Drive folder into structured expense records. On a schedule it lists the folder, and for each new receipt it downloads the file, runs Azure AI Document Intelligence (prebuilt-receipt OCR) to extract vendor / date / total, archives the original into a dated SharePoint folder, appends a row to a Dataverse expense table (deduped by the Drive file id), and emails finance.
Why it matters: Manual receipt entry is slow and error-prone. Auto-extraction speeds reimbursement and keeps a clean, queryable expense ledger.
As-built status: Built and verified in the default environment, shipped Off (demo). Flow Checker: 0 errors / 0 warnings.
Use Case
Employees drop receipt images/PDFs into a shared Google Drive folder. Finance needs each one logged automatically with the key fields extracted, the original archived for audit, and a notification so they can reconcile.
Audience: Finance, Operations.
Flow Architecture
Recurrence
Built-in Recurrence (every 15 min)Poll for new receipts (no native Drive trigger).
Init_*
Initialize VariableCorrelation id (guid()), status label, processed counter, and the 6 env-var-bound config values.
List_Drive_Files
Google Drive ListFolderList the receipts folder (bare array of file metadata).
Filter_Files_Only
Filter arrayDrop sub-folders (IsFolder = false).
Apply_to_each_Receipt
Foreach (concurrency 1)Per receipt: dedup lookup by source file id, condition not-logged, download file content, submit prebuilt-receipt OCR via HTTP, delay 10s, get OCR result, compose vendor/date/total/currency, archive to SharePoint CreateFile, create Dataverse expense record, notify finance via Outlook, increment counter.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_ReceiptSourceFolderId | String | <configure> | Google Drive folder the flow polls. |
| flowlibs_SharePointSiteURL | String | https://your-tenant.sharepoint.com | SharePoint site for the archive. |
| flowlibs_ReceiptArchiveLibraryPath | String | /Shared Documents/Finance Receipts | Library base path; flow appends /yyyy/MM. |
| flowlibs_FinanceNotifyEmail | String | finance@yourcompany.com | Notification recipient. |
| flowlibs_DocIntelligenceEndpoint | String | https://<resource>.cognitiveservices.azure.com | Document Intelligence endpoint. |
| flowlibs_DocIntelligenceApiKey | String | <configure> | Document Intelligence subscription key. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Google Drive | shared_googledrive | ListFolder GetFileContent |
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords CreateRecord |
| SharePoint | shared_sharepointonline | CreateFile |
| Office 365 Outlook | shared_office365 |
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Poll cadence
- Adjust the Recurrence interval (default 15 min).
- Policy check
- Add a Condition after Compose_Total to flag over-limit expenses before logging.
- Vendor categorization
- Classify by Compose_Vendor and store a category column.
- Approval routing
- For high amounts, insert an Approvals action before Create_Expense_Record.
- Low-confidence review
- Branch on the Document Intelligence confidence score to queue uncertain extractions for manual review.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Vendor
Extracted merchant name with fallback.
EXPR.02Date
Receipt date with today fallback.
EXPR.03Total
Total amount with zero fallback.
EXPR.04Dedup filter
Lookup by Drive file id to dedup.
EXPR.05Dated archive path
Builds the yyyy/MM archive folder path.
EXPR.06OCR submit body
Document Intelligence analyze request body.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.