Skip to content

parserdata/parserdata-powerautomate-sharepoint-invoices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Power Automate ParserData SharePoint

ParserData + Power Automate: SharePoint/OneDrive invoice extraction

Automatically extract structured invoice data from documents in SharePoint or OneDrive using Microsoft Power Automate and the ParserData API, then save clean JSON results to SharePoint Lists, Excel, or other Microsoft 365 services.

What this flow does

This Power Automate flow creates a fully automated document processing pipeline:

  • Triggers on new invoice uploads to SharePoint/OneDrive folder
  • Downloads the document file
  • Sends it to ParserData extraction API with structured prompt
  • Parses the API response to extract invoice fields
  • Saves structured data to SharePoint List, Excel Online, or sends via Teams/Email

Popular use cases

1. SharePoint → ParserData → SharePoint List

  • Trigger: New file uploaded to SharePoint document library
  • Action: Extract invoice data using ParserData
  • Output: Create item in SharePoint List with extracted fields
  • Best for: Finance teams using SharePoint for document management

2. OneDrive → ParserData → Excel Online

  • Trigger: New invoice saved to OneDrive folder
  • Action: Extract all invoice fields
  • Output: Add row to Excel Online spreadsheet
  • Best for: SMBs and accounting automation

3. SharePoint → ParserData → Teams Notification

  • Trigger: New vendor invoice in SharePoint
  • Action: Extract and validate invoice data
  • Output: Send adaptive card to Microsoft Teams with invoice summary
  • Best for: Approval workflows and team notifications

Requirements

Before you start, ensure you have:

  • Microsoft 365 account with Power Automate license
  • SharePoint site or OneDrive account for file storage
  • ParserData API key (Sign up)
  • SharePoint List or destination for extracted data (optional)

Step-by-step setup

Step 0: Create environment variable

⚠️ IMPORTANT: Never hardcode your API key in flows. Use Power Automate environment variables:

  1. Go to Power Platform Admin Center (admin.powerplatform.microsoft.com)
  2. Navigate to Environments → Select your environment
  3. Go to SettingsVariablesEnvironment variables
  4. Click NewCreate environment variable
    • Display name: ParserData API Key
    • Name: ParserDataAPIKey
    • Data type: Text
    • Values: Enter your actual API key
  5. Save

Why: This keeps your API key secure and allows easy rotation without modifying flows.

Step 1: Create the flow

  1. Go to Power Automate
  2. Click + CreateAutomated cloud flow
  3. Give it a name: Invoice Processing - SharePoint to ParserData
  4. Choose trigger: When a file is created (SharePoint) or When a file is created (OneDrive)
  5. Click Create

Step 2: Configure the trigger

For SharePoint:

  1. Site Address: Select your SharePoint site
  2. Library Name: Select your document library (e.g., "Invoices")
  3. Folder: Optional - specify subfolder path

For OneDrive:

  1. Folder: Select the folder to monitor (e.g., /Invoices/Incoming)

Step 3: Get file content

Add a new step: Get file content

  1. Click + New step
  2. Search for "Get file content"
  3. Choose either SharePoint or OneDrive connector
  4. File Identifier: Use the dynamic content Identifier from the trigger

Step 4: Call ParserData API (HTTP action)

Add a new step: HTTP (Premium connector)

  1. Click + New stepHTTP
  2. Configure:
Parameter Value
Method POST
URI https://api.parserdata.com/v1/extract
Headers X-API-Key → Use environment variable

Configure Headers:

  1. Click Show advanced options
  2. Headers:
Key: X-API-Key
Value: @{environmentVariables('ParserDataAPIKey')}

Step 5: Parse API response

Add a new step: Parse JSON

  1. Click + New stepParse JSON
  2. Content: Use the Body from the HTTP action
  3. Schema: Click "Generate from sample" and paste sample API response

Step 6: Save extracted data

Choose your destination:

Option A: SharePoint List

  1. Add action: Create item (SharePoint)
  2. Map extracted fields to list columns

Option B: Excel Online

  1. Add action: Add a row into a table (Excel Online)
  2. Map extracted fields to table columns

Option C: Teams notification

  1. Add action: Post adaptive card and wait for response (Teams)
  2. Format extracted data as adaptive card

Step 7: Error handling

Add Configure run after settings:

  1. Click the three dots on HTTP action
  2. Select Configure run after
  3. Check: has failed, has timed out
  4. Add a parallel branch for error notifications

Error handling & Retry logic

Power Automate provides built-in retry policies:

  1. Click on the HTTP action
  2. Select Settings (gear icon)
  3. Under Retry Policy:
    • Count: 3 retries
    • Interval: PT5M (5 minutes)
    • Type: Exponential interval

Why exponential: Provides better recovery for transient API failures without overwhelming the service.

Customizing the extraction

Modify the extraction prompt to extract different fields:

{
  "prompt": "Extract purchase order number, vendor name, order date, delivery address, line items (product code, description, quantity, unit price, total), and approval status."
}

Security best practices

  1. Use Environment Variables - Never hardcode API keys
  2. Limit SharePoint Permissions - Grant minimum required access
  3. Enable Flow Audit Logs - Track who runs flows and when
  4. Rotate API Keys Regularly - Update environment variable when rotating
  5. Use Data Loss Prevention (DLP) - Configure DLP policies for HTTP connector

Performance considerations

  • File Size Limits: Check documentation for latest limits
  • Timeout: Set HTTP timeout to 5 minutes for large documents
  • Concurrency: Power Automate handles concurrent flows automatically (check your plan limits)
  • Rate Limits: ParserData API has rate limits - adjust flow frequency accordingly

Troubleshooting

Common issues

Issue Solution
HTTP 401 Unauthorized Verify API key in environment variable, check key is active
HTTP 429 Rate Limit Reduce flow frequency, implement exponential backoff
Timeout Errors Increase HTTP timeout in action settings
File Not Found Verify SharePoint/OneDrive folder path and permissions
Malformed Response Check API response format, update JSON schema if needed

Debugging tips

  1. Use Flow Checker to validate flow before saving
  2. Enable Flow Analytics to monitor performance
  3. Check Run History for detailed error messages
  4. Test with Test button using sample files
  5. Use Compose actions to debug intermediate values

API reference

  • Endpoint: POST https://api.parserdata.com/v1/extract
  • Headers:
    • X-API-Key: Your API key
    • Content-Type: multipart/form-data
  • Body Parameters:
    • file: Binary file content
    • prompt: Extraction instructions
    • options: JSON with return_schema and return_selected_fields flags
  • Response: JSON with extracted fields

Full API documentation: https://parserdata.com/parserdata-api

License

MIT

Need help?

This repository is a reference example. For production support or custom integration needs, contact support@parserdata.com.

About

Automate invoice data extraction from SharePoint or OneDrive using Microsoft Power Automate and the ParserData API, saving structured results to Excel or SharePoint Lists.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors