Invoice parsing automation Microsoft Flow, Mindee and Excel
Tags: microsoftflow, invoice, machinelearning, api
Published: 2021-02-25 21:18:28

---
title: Invoice parsing automation Microsoft Flow, Mindee and Excel
published: true
description: 
tags: microsoftflow, invoice, Machinelearning, api
cover_image: https://mindee-public-website.s3.amazonaws.com/blog/screenshot-2021-01-13-at-190441.png
canonical_url: https://mindee.com/blog/invoice-parsing-automation-microsoft-flow-mindee-and-excel
---

<h1>Invoice parsing automation Microsoft Flow: Mindee and Excel</h1>

<p>&nbsp;</p>

<p>Mindee&rsquo;s invoice parsing API makes the extraction of invoice details quick and easy.&nbsp; Our RESTful API takes an image or PDF of an invoice and extracts all of the pertinent details of the invoice.&nbsp; In under a second, it returns a JSON response with the extracted elements along with coordinates of their visual location in the document and the confidence of our ML algorithm.&nbsp; We&rsquo;ve blogged on how to use the Invoice API with <a href="https://mindee.com/documentation/apis/invoice-parsing">Curl</a>,&nbsp;<a href="https://mindee.com/documentation/apis/invoice-parsing/invoice-parse-nodejs">NodeJS</a>,&nbsp;and <a href="https://mindee.com/documentation/apis/invoice-parsing/python-invoice">Python</a>.</p>

<p>&nbsp;</p>

<p>We realize that this is just part of the invoice &lsquo;process&rsquo; at your company. In this post, we&rsquo;re going to extend the API further using Microsoft Power Automate.&nbsp; By creating a &lsquo;flow&rsquo; for your invoices you can build automation connecting different Office 365 services to automate your workflows.</p>

<p>&nbsp;</p>

<h2>Robotic Process Automation (RPA)</h2>

<p>RPA is using computers and automation to streamline mundane tasks. By reducing the number of time employees have to do simple and repetitive tasks, the employees have more time for high-value work - increasing productivity and reducing human&nbsp;errors that might occur during the process.&nbsp; The process described below certainly removes a lot of process steps to the invoice process, so it is an RPA.</p>

<h3>&nbsp;</h3>

<h3><strong>Low Code/ No Code</strong></h3>

<p>&nbsp;</p>

<p>Even better, this process also can be considered a low code implementation.&nbsp; There&#39;s no need to pull one of your developers off a&nbsp;project to implement. Simply following these instructions (and having access to an Office 365 account), any member of staff should be able to add this automation step to the invoice process.</p>

<p>&nbsp;</p>

<h2>Complete Invoice Processing</h2>

<p>Extracting the pertinent data from the invoice is a huge step in simplifying the processing of an invoice, but it is just one step in the required workflow.&nbsp; In today&rsquo;s digital age, many invoices arrive via email and must be rescued from your inbox for processing. Then all the details must be entered into a spreadsheet (or another database) - all this before you actually *PAY* the invoice.&nbsp;</p>

<p>&nbsp;</p>

<p>Many of these steps can be automated, and with&nbsp;<a href="https://mindee.com/documentation/apis/invoice-parsing"><u>Mindee&rsquo;s Invoices API</u></a>, the most tedious part (the data entry into the payment system) can be automated as well. If your company is using Microsoft Office 365, this automation can be done using Microsoft&#39;s&nbsp;Power Automate flows.</p>

<p>&nbsp;</p>

<p>In the following example, we&rsquo;ll automate the process from email delivery to storing the invoice data into an Excel Online spreadsheet. Inside the workflow itself, we&rsquo;ll save the invoice to a document library SharePoint Online, call the Mindee&rsquo;s Invoices API and populate additional, custom columns in the SharePoint library and. A picture is worth a thousand words, so here is a diagram of the flow as we built it:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-190441.png" /></p>

<p>&nbsp;</p>

<h3><strong>Test the Flow</strong></h3>

<p>&nbsp;</p>

<p>You can try this flow by sending an email to <a href="mailto:doug@riolinx.com"><u>doug@riolinx.com</u></a>&nbsp;(make sure you attach an invoice in PDF or JPG&nbsp;format). Microsoft Flows seem to run every 5 minutes or so, so you&rsquo;ll soon see your invoice parsed and added to the <a href="https://riolinx365-my.sharepoint.com/:x:/g/personal/doug_riolinx_com/EcHR-jrlYSRBkFMx6DbI7mUBzawhzsBGc1CsDAo27fVD5Q?e=rpJRgx">Excel document</a>.&nbsp; Feel free to try it out as often as you&rsquo;d like!</p>

<p>While this is a fu example, it does not do a lot of good for your company&#39;s invoices to end up in a publically available spreadsheet on the internet.&nbsp; You&#39;ll want to create your own (private) version of this Flow for your company&#39;s invoices.&nbsp; Read on to learn how:</p>

<p>&nbsp;</p>

<h2>Importing the Flow</h2>

<p>&nbsp;</p>

<p>The flow we created is available on <a href="https://github.com/publicMindee/microsoft-flow-invoice-integration">Github</a>.&nbsp; Download the &quot;MindeeInvoiceswithMicrosoftFlow.zip&quot; from the repository.&nbsp; (You&#39;ll also need the invoice_excel.xlsx file in a bit, so you might as well download that now as well.).</p>

<p>To add the Flow to your Microsoft account,&nbsp;navigate to <u><a href="https://flow.microsoft.com">https://flow.microsoft.com</a></u>&nbsp;and log in with your work credentials.&nbsp; You may have to create a free trial of <a href="https://powerapps.microsoft.com/en-us/">Power Apps</a> if you do not already have Flow/Power apps enabled.&nbsp;</p>

<p>Click on the &ldquo;My Flows&rdquo; in the left navigation.&nbsp;&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-191556.png" style="width:300px !important" /></p>

<p>&nbsp;</p>

<p>On&nbsp;this page, there is a link to import a flow:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-191643.png" style="height:119px; width:300px !important" /></p>

<p>&nbsp;</p>

<p>Click import to begin the upload of the Zip file. After the Zip file is uploaded, the page&nbsp;will ask you to name the flow and to connect it to your Outlook account. The connection is required in order for the Flow to have access to your emails.</p>

<p>&nbsp;</p>

<p>Step 1:&nbsp; Under name - import setup - Create as new, and give the Flow a name that makes sense for your organization.</p>

<p><br />
Step 2: Connect your Outlook - click &ldquo;select during import.&rdquo;&nbsp; In my case, I did not have a Flow connection set to Outlook, so I had to click &ldquo;Create New&rdquo; and connect to my SharePoint account.&nbsp; Clicking the refresh allowed me to add the connection:</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-191854.png" /></p>

<p>&nbsp;</p>

<p>Here I am connecting to a new email address in a new Microsoft Flow account.</p>

<p>Now, once all the connections have been made, you can press the blue import button at the bottom of the page.&nbsp;After a few seconds, the&nbsp;package will import successfully.</p>

<p>&nbsp;</p>

<h2>Editing the flow</h2>

<p>&nbsp;</p>

<p>In order for this flow to succeed in your Office 365 environment, you&rsquo;ll need to make a few edits. Head back to &ldquo;My Flows&rdquo; and select the Mindee integration and press the edit button.</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-192227.png" /></p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<h3><strong>Add your email account</strong></h3>

<p>&nbsp;</p>

<p>The email account that receives invoices in your organization. In the flow, it is currently set to <a href="mailto:doug@riolinx.com"><u>doug@riolinx.com</u></a> - which does your organization very little good.&nbsp; We&rsquo;ll need to update that:</p>

<p>Click the &ldquo;On new email&rdquo; and select advanced options:</p>

<p><br />
<img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-192558.png" /></p>

<p>&nbsp;</p>

<p>Now, edit the &ldquo;To&rdquo; field to correspond to the address that will be receiving invoices in your organization.</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<h3><strong>Mindee API Key</strong></h3>

<p>The next step in the process is your Mindee API Key.&nbsp; You&rsquo;ll need to paste in your API key in the Value field.&nbsp; To obtain a Mindee Invoice API Key, visit Mindee.com and follow these <a href="https://mindee.com/documentation/apis/invoice-parsing">steps to get your key</a>.</p>

<p>&nbsp;</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-193946.png" /></p>

<p>&nbsp;</p>

<p>Now you can save your Flow. To turn it on, head back to the main view of your flow, and select &ldquo;Flow Checker&rdquo;. You&#39;ll see a warning that the flow is off - and a button to turn it on.</p>

<p>&nbsp;</p>

<p><em>This will flag another warning - don&rsquo;t worry - it is just telling you that the flow has never run successfully.&nbsp; Of course, it hasn&rsquo;t - you haven&rsquo;t had a chance yet!</em></p>

<p>&nbsp;</p>

<h3><strong>Test it out</strong></h3>

<p>Send an invoice to the email address you configured in the flow (don&#39;t forget to attach&nbsp;an invoice!).&nbsp; The Flow will run in the next few minutes, and you&rsquo;ll see the successful run in your 28-day run history.</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-194218.png" /></p>

<p>&nbsp;</p>

<p>Clicking the date and time (in the 28-day run history table) allows you to check the status. If you scroll to the bottom of the Flow, you&rsquo;ll see the&nbsp; &ldquo;apply to each attachment in the email.&rdquo; Open this, and then Open &ldquo;Update Excel Online Spreadsheet&rdquo;, and open one of the variables:</p>

<p><br />
<img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-194415.png" /></p>

<p>&nbsp;</p>

<p>The screenshot above shows that the API correctly extracted the invoice date as 29 June 2020.&nbsp; This is super cool - as we now have a Flow that interacts with the Mindee API to extract data from submitted invoices.</p>

<p>&nbsp;</p>

<p>But your Flow does not actually <strong>DO</strong> anything with that data yet.&nbsp; In the next sections, we&rsquo;ll connect the flow to Excel and to SharePoint, and submit the data to these Office tools for future manipulation.</p>

<p>&nbsp;</p>

<h2>Connect an Excel Online Spreadsheet&nbsp;&nbsp;</h2>

<p>&nbsp;</p>

<p>In the Github repo, there is an excel file: Invoice_excel.&nbsp; Upload this into your Excel Online account.&nbsp; To do this: Open Excel in a new tab:</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-200759.png" /></p>

<p>&nbsp;</p>

<p>Upload the file into Excel. It will open, and you&rsquo;ll find an empty table with headers that look like they will intake invoice data. This table is named &ldquo;invoices2021&rdquo;</p>

<p>&nbsp;</p>

<h3><strong>Connect the Flow to the Excel table:</strong></h3>

<p>&nbsp;</p>

<p>Back in your Flow, click the edit button and open the &ldquo;apply to each Attachment in the email&rdquo; (at the bottom).&nbsp; Open the &ldquo;Update Excel spreadsheet&rdquo; entry and add an action at the bottom(the circle with a &#39;+&#39; sign in it).&nbsp; We&rsquo;re going to &ldquo;add a row to a table&rdquo;:</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-200952.png" /></p>

<p>&nbsp;</p>

<p>Choose the Invoice_excel file you just uploaded:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-201215.png" /></p>

<p>&nbsp;</p>

<p>And the table is &ldquo;invoices2021.&rdquo;&nbsp; Now that this is added, all of the columns in the table will appear in the Flow.&nbsp; Add the variables that were assigned earlier by clicking each entry&nbsp;box in the form, and adding the dynamic variables as shown below (the purple dynamic entries correspond to the variables that exit the Mindee flow):</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-201314.png" /></p>

<p>&nbsp;</p>

<p>Click save, and test the flow. You can use the trigger you used in the initial test to run the flow immediately.</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-201406.png" style="width:300px !important" /></p>

<p>The difference is now that the invoice details are added automatically to the Excel file.</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-201520.png" /></p>

<h2>Yes!!!</h2>

<h2>&nbsp;</h2>

<h2>Saving the file to SharePoint</h2>

<p>In My SharePoint site, I have created a new document library called &quot;invoice&quot;. When it is created, I land on a&nbsp;page with a table where my files will end up.</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-214645.png" /></p>

<p>&nbsp;</p>

<p>Looking at the column names, I see that I can add columns to my table!&nbsp; We can add the extracted Mindee data right into the SharePoint Table:</p>

<p>&nbsp;</p>

<p>Clicking &quot;add column&quot; (note: always choose &quot;single line of text&quot; - in case of the API responds with a &quot;N/A&quot;)&nbsp;opens this dialogue:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-215105.png" style="width:300px !important" /></p>

<p>&nbsp;</p>

<p>For this example, I picked 4 variables: supplier name, invoice date, due date, and total due. I could have added more - it is up to you what data you want to appear here.</p>

<p>&nbsp;</p>

<h2>Connect the Flow to SharePoint</h2>

<p>Now that we&#39;ve created the library, we need to wire it to connect to our automated Flow.</p>

<p>First, we&#39;ll want to insert the file into the document library.&nbsp; So between the last variable, and before we add to the Excel table, insert a step Sharepoint: Create File:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-220039.png" /></p>

<p>&nbsp;</p>

<p>Fill in the form - the SharePoint and Folder path are your company&#39;s SharePoint, and the library you just created for your invoices.&nbsp; Then use the dynamic variables to add the &quot;Attachment Name&quot; and &quot;attachment contents&quot; to the last two fields.</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-220131.png" /></p>

<p>&nbsp;</p>

<p>The file is now added, but to fill the new columns created in the library, we need yet another connector:&nbsp; SharePoint: Update File Properties:</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-220811.png" /></p>

<p>&nbsp;</p>

<p>We again connect this to our new SharePoint Library.&nbsp; To specify which line we apply, choose ItemId - this refers back to the document we just created one step back.&nbsp; When you add the library name, it will find all of the columns, you added. Then we can use the variables from the Mindee Flow to fill out the columns of the SharePoint library, as shown above.</p>

<p>&nbsp;</p>

<h2>Adding the SharePoint Path to Excel</h2>

<p>&nbsp;</p>

<p>The Excel table has fields to help you find the file in SharePoint, so go back to the &quot;add a row to excel: and insert the SharePoint Filename and path to the flow, and connect the dots between all the files and connections we&#39;ve made with this flow.</p>

<p>&nbsp;</p>

<p>Now we&#39;re ready to save the whole flow, and test!</p>

<p>&nbsp;</p>

<h2>The test</h2>

<p>&nbsp;</p>

<p>Once we send an email to the account, we see that not only is the invoice added to the SharePoint Library, but the details are also added to the excel table (with the SharePoint file details in the Excel file):</p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-222724.png" /></p>

<p>&nbsp;</p>

<p><img alt="" src="https://mindee-public-website-staging.s3.amazonaws.com/blog/2021/01/13/screenshot-2021-01-13-at-222714.png" /></p>

<p>&nbsp;</p>

<h2>Conclusion</h2>

<p>&nbsp;</p>

<p>To increase productivity, many organizations are using Robotic Process Automation and low/no-code tools to automate tedious and slow tasks.&nbsp; The processing of invoices is one such process that is readily suited for automation.&nbsp;</p>

<p>Using Mindee&#39;s API to extract&nbsp;data from an invoice is just one piece of the invoice pipeline. In this demo, we&#39;ve extended the use of the Mindee invoice extraction API with Microsoft Flow - taking an email attachment, saving it in SharePoint, and extracting the details as column data in SharePoint as well as creating a row in Excel.</p>

<p>With all of the tools inside Microsoft 365, this is just the tip of the iceberg - you could potentially integrate with any other product in the suite. Try out our Mindee Flow to extract data, and then use the variables to wire the data into your favorite Microsoft Project.&nbsp; If you have any questions (how to reach out, etc.)</p>

<p>&nbsp;</p>

<p>&nbsp;</p>