Showing results for 
Search instead for 
Did you mean: 

How to extract data from email messages in Microsoft Flow and Azure Logic Apps

In this article, I will describe how to extract values from email messages and store them somewhere with the help of Microsoft Flow or Azure Logic Apps.


Let’s suppose you are getting a new email after someone made a purchase and you need to extract information from this email and create a new item in your orders SharePoint list.


Your email might look like this:


*** Order information ***
Time zone: GMT+00:00
Reference: 4563452
Order number: 1400
Payment method: Visa/MasterCard
Order status: Credit card payment authorized

*** Ordered products ***
Product code: D3F13B23B0
Title: Tires
Price: 150
Quantity: 4

Product code: FD3423DE
Title: Cookies
Price: 30
Quantity: 20

Product code: KFG45GK445
Title: Tools
Price: 50
Quantity: 10

*** Delivery information ***
First name: John
Last name: Doe
Company: Happy Company Ltd
Country: Australia
Phone: 01 2345 6780


I will use Regular Expression Match action from our Plumsail Documents.


Your flow might look like this:




For this case, I'm using the trigger to manual start of the flow. You can use any other trigger available in Microsoft Flow.


Receive email


First, we receive an email in Outlook, you can specify Subject Filter field so this trigger will be working only the ones that have ‘Order’ in their subject.




Regular Expression Match


Then we are using Regular Expression Match action to find three values: Title, Price, and Quantity in our email's body.




Here is a regex we are using in this flow:


Title: (?<Title>.+|)
Price: (?<Price>.+|)
Quantity: (?<Quantity>\d+)


You may notice that Regular expression match in this regular expression has a few outputs:




There is "Match0" is a full match for the whole regular expression. There are also separate output values for each named regular expression group: Price, Quantity, Title.


You can learn more about named groups on this page. The action is smart enough to create separate output value in Microsoft Flow for each named regular expression group that is used in it. It dramatically simplifies the extraction of values from text strings. You just write a regular expression with named groups and then use them across your flow.


You can easily put match regex into a named group like this: (?<Title>.+|). The name of this group will be "Title", everything that matches regular expression .+| will be returned as a separate output of the action.


Note, the action returns an array of matches, because you may have multiple matches in your text. This is how JSON representation of result may look with multiple matches:


        "Match0": " Title: Tires\r\nPrice: 200\r\nQuantity: 4",
        "Title": "Tires",
        "Price": "150",
        "Quantity": "4"
    }, {
        "Match0": " Title: Cookies\r\nPrice: 30\r\nQuantity: 20",
        "Title": "Cookies",
        "Price": "30",
        "Quantity": "20"
    }, {
        "Match0": " Title: Tools\r\nPrice: 50\r\nQuantity: 10",
        "Title": "Tools",
        "Price": "50",
        "Quantity": "10"


Create item in SharePoint list


In the last step, we are using the values from the previous step to create an item in 'Orders' SharePoint list.




In this action, we are going through the 'Matches' array and we are getting its values in the cycle, using the named groups as keys.


Then we are using these keys values to create an item in our SharePoint 'Orders' list.




Now you should have an idea how to work with Regular Expression Match action in Plumsail Documents connector for Microsoft Flow. If you haven’t used it yet, registering an account would be the first step, you can learn about it here. It is quite easy to get started.


This article was originally published here.

Meet Our Blog Authors
  • Working daily with Microsoft Cloud to deliver the needs of my company, my customers and various Microsoft communities and forums. | Office 365 | Flow | PowerShell | PowerApps | SharePoint |
  • Co-founder of, Office 365 and SharePoint expert. Passionate about design and development of easy to use, convenient and flexible products.
  • Microsoft Business Apps MVP. Owner of ThriveFast, an Office 365 consulting company.
  • 7x Microsoft Business Solutions MVP (CRM)
  • I'm keen in MS technologies, SharePoint, Office 365 and development for them
  • Daniel is a Business Productivity Consultant & Microsoft Business Solutions MVP who is very enthusiastic about all things Office 365, Microsoft Flow, PowerApps, Azure & SharePoint (Online). Since the preview, Daniel has been working with Microsoft Flow and later on with Microsoft PowerApps. That led to him being awarded an MVP Award for Business Solutions. He loves to blog, present and evangelize about improving productivity in the modern workspace with these amazing tools!
  • Michelle is an Office 365 solution architect in Twin Cities, MN. She has been delivering business collaboration solutions for years with her focus on SharePoint and Office 365. Michelle is a recent board member of the Minnesota Office 365 User Group and has been a member of the SharePoint community since 2009. She is a frequent speaker at MNSPUG and SharePoint Saturday and co-chaired the Legal SharePoint User Group for 4 years. Her most frequent projects have involved rolling out a large deployment of Office 365, SharePoint Online intranet, build of a "CHAMPS" Office 365 user adoption program and most recently, SharePoint On-Premise to Online Migration. Michelle is very excited about cloud technology as it is shifting her IT Pro focus to collaboration strategy and technical adoption.
  • I'm a Microsoft Office Servers and Services MVP with a special interest in SharePoint, Office 365, Microsoft Flow, Microsoft Teams and PowerApps. I work at Triad Group Plc (
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor