← Back to Case Studies
Process Automation / Excel + Azure

Purchase Orders from Email to Invoice, Without Re-typing

Type: Excel + Azure Automation Client: A Canadian consumer-goods supplier

The Situation

A Canadian consumer-goods supplier sells to a large North American retail group. Every purchase order arrives as a PDF attached to an email. The volume was climbing toward roughly forty orders a week, spread across four ordering channels — two US store banners, US e-commerce, and Canada — with separate US and Canadian invoice numbering sequences.

The process was entirely manual. Staff opened each email, read the PDF, and re-typed the order details into Excel to produce a packing slip, carton labels, and an invoice. For forty orders a week that is a lot of re-typing, and re-typing means errors.

The operators are not Excel power users. Whatever we built had to be simple enough that someone could sit down, press one button, and work through a guided queue. Ease of use was priority one.

What We Built

The solution has two halves: a small cloud pipeline that reads the PDFs and delivers structured data, and an Excel workbook that turns that data into documents.

The cloud half

It lives entirely in the client's own Azure tenant. An Outlook rule — set up and controlled by the client — files PO emails into a designated folder in a shared mailbox. Every five minutes an Azure Function checks that folder, copies each PDF attachment to blob storage, and tags the email as processed. It never moves or deletes anything, so the mailbox folder is always a reconcilable archive of every order received.

When the PDF lands in storage, an Event Grid event triggers a second function. That function reads the PDF, identifies the ordering channel and PO number, and writes the PDF plus a structured data file to the correct SharePoint folder. If a PDF is a duplicate or can't be read, it goes to a Needs Review folder with a reason attached.

The Excel half

The workbook never talks to Azure. OneDrive syncs the SharePoint library down to each operator's PC, and the workbook reads local files. One button processes the queue. A guided review form walks the operator through each order — channel, invoice number, quantities (editable, because partial shipments happen).

Two automatic invoice sequences run independently with no duplicate numbers. The workbook produces packing slips, invoices, and carton labels in the client's own layouts, keeps a processing log with duplicate-shipment warnings, and has an admin lock so operators see only the screens they need: Start, Config, and Log.

We also built import-from-previous-version migration and client-styled user guides.

Problems We Solved Along the Way

  • ✓ PDF reading moved to the cloud. Pure-VBA PDF parsing was not viable for this mix of documents, and two of the retail banners needed image recognition to extract order data. That pushed the PDF reading into the cloud pipeline.
  • ✓ No licensing strings attached. Early on we used an AGPL-licensed PDF library. AGPL has copyleft obligations that would have complicated the client's deployment, so we replaced it with a BSD-licensed alternative.
  • ✓ Burst-safe parsing. A forty-PDF burst test crashed the parser. The PDF library turned out not to be thread-safe. We added a process-wide lock so PDFs are parsed one at a time under load. After the fix, burst-test results matched single-file results exactly.

How It Went

We proved the parser on dozens of the client's real POs across all four channels before anyone committed to the full build. The final pre-release test produced correct results on every outcome path. The first live PO reached SharePoint within minutes of go-live. The first batch of real Canada orders all processed cleanly — none sent to Needs Review.

The client's own IT team deployed the Azure side from a step-by-step guide we wrote. Hands-on time was roughly an hour and a half to two hours. Jerts never held any of their credentials. We proved the entire pipeline in our own Azure tenancy first, then handed over a tested, documented deployment package.

Technical Sidebar: Azure Configuration

ComponentDetail
ComputeAzure Functions, Flex Consumption plan, Python runtime
Trigger (mailbox poll)Timer trigger, 5-minute interval
Trigger (PDF processing)Event Grid, BlobCreated event
IdentitySystem-assigned managed identity — no secrets stored, no Key Vault needed
Mail accessMicrosoft Graph Mail.ReadWrite (application permission) plus an Exchange Online application access policy restricting access to the one shared mailbox
SharePoint accessSites.Selected permission, write access on one site only
StorageTLS 1.2 enforced, no public access
Duplicate protectionAtomic create-if-absent marker blob per PO
LoggingAppend-only daily event log in blob storage
MonitoringApplication Insights
HeartbeatHeartbeat file written each run
Unreadable / duplicate handlingRouted to Needs Review folder with reason
DeploymentStep-by-step guide; client IT deployed (~1.5–2 h hands-on); pipeline proven in Jerts tenancy first

Configuration Lessons

  • 1. Pair tenant-wide Graph mail permissions with an Exchange application access policy. A Mail.ReadWrite application grant covers every mailbox in the tenant. The Exchange Online application access policy restricts it to just the one shared mailbox you need. Allow about thirty minutes for the policy to take effect after you create it.
  • 2. Use Sites.Selected for SharePoint. It gives write access to exactly one site, nothing else.
  • 3. System-assigned managed identity removes the need for secrets. No Key Vault, no connection strings to rotate, no credentials to leak.
  • 4. Let a business-controlled mail rule define scope. The client's own Outlook rule decides which emails enter the pipeline. If they want to change what gets processed, they edit a mail rule — no code change, no redeployment.
  • 5. Tag processed emails — don't move or delete them. The mailbox folder stays intact as a complete, reconcilable archive. A category tag is enough to track what has been processed.
  • 6. Route data through SharePoint and OneDrive so Excel needs no cloud credentials. The cloud pipeline writes to SharePoint. OneDrive syncs to the operator's PC. Excel reads local files. The workbook never authenticates to anything.
  • 7. Test bursts, not just single files. A forty-PDF burst exposed a thread-safety issue that single-file testing would never have found.
  • 8. On Flex Consumption, blob triggers must be Event Grid–sourced. The classic Storage-based blob trigger is not supported on the Flex Consumption plan. Use an Event Grid BlobCreated subscription instead.

Technology

Excel Azure Functions (Python) Event Grid Blob Storage Microsoft Graph Exchange Online SharePoint OneDrive Application Insights

Have a similar challenge?

If orders or other documents reach you as email attachments and someone re-types them into Excel, we can probably automate it. Let's talk.

Get in Touch