cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Extract text from body of an email and create new rows in excel spreadsheet

Hello - 

 

As the title says, I'm trying to extract text from body of an email and create new rows in excel spreadsheet.

I've used the 'HTML to text' to get the info, but when I go to push it to the spreadsheet, all of the data goes into one column (in the new row).

 

How can I get individual items from the body previously extracted using the HTML-to-text and insert each item into its own column  in the new row?

 

For example:

Date:

Unit Number:

Run Number:

Pick Up:

Drop Off:

 

similar to https://powerusers.microsoft.com/t5/Building-Flows/Extract-text-from-Body-of-an-email-in-Flow/m-p/51...

 

Parserr will work for what I need it to do...in fact it's perfect, but I'll need to run ~ 200 emails a month through this process and Parserr is just waaay to expensive for that. One would think this should be a fairly easy process using microsoft's own tools, but seeing as how someone else has built a better mousetrap, I'm wondering if it even IS possible to do so without a third party. (Plus I have regulations I have to follow, HIPAA, etc.)

 

Thanks!!

1 ACCEPTED SOLUTION

Accepted Solutions
v-yuazh-msft
Community Support
Community Support

Hi @ tcm692,

 

 

I have made a test on my side.

 

The content in the email body as below:

Date:20180410

Unit Number:200

Run Number:180

Pick Up:100

Drop Off:80

 

You could refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the "Date" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Unit Number')),':'),1))

The expression in the "Unit Number" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Run Number')),'Unit Number:'),1))

 

The expression in the "Run Number" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Pick Up')),'Run Number:'),1))

 

The expression in the "Pick Up" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Drop Off')),'Pick Up:'),1))

 

The expression in the "Drop Off" field of "Insert row" action as below:

first(skip(split(body('Html_to_text'),'Drop Off:'),1))

When the email with the body which I provided above arrives, the flow would run successfully to insert those value to excel rows as below:

Capture.PNG

 

The row would be inserted to the excel as below:

Capture.PNG

 

 

 

Regards,
Alice Zhang

View solution in original post

17 REPLIES 17
vecerpa
Memorable Member
Memorable Member

Hi @Anonymous,

 

As far as I know there is no way to parse email body except using Parserr. There is no function inside Flow that will do this.

 

In some cases there is possible to lets say converse html Body to Text and then split it by some splitter for example comma. But this request that incomming email is formatted somehow. For exmaple like on image below.

 

FlowParseEmail.PNGFlowParseEmail1.PNG

 

 

The result is that I have excel added one row in table:

 

FlowParseEmail3.PNG

 

But there is need to have specific input to be able to parse it so simple...

P.

v-yuazh-msft
Community Support
Community Support

Hi @ tcm692,

 

 

I have made a test on my side.

 

The content in the email body as below:

Date:20180410

Unit Number:200

Run Number:180

Pick Up:100

Drop Off:80

 

You could refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the "Date" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Unit Number')),':'),1))

The expression in the "Unit Number" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Run Number')),'Unit Number:'),1))

 

The expression in the "Run Number" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Pick Up')),'Run Number:'),1))

 

The expression in the "Pick Up" field of "Insert row" action as below:

first(skip(split(first(split(body('Html_to_text'),'Drop Off')),'Pick Up:'),1))

 

The expression in the "Drop Off" field of "Insert row" action as below:

first(skip(split(body('Html_to_text'),'Drop Off:'),1))

When the email with the body which I provided above arrives, the flow would run successfully to insert those value to excel rows as below:

Capture.PNG

 

The row would be inserted to the excel as below:

Capture.PNG

 

 

 

Regards,
Alice Zhang

Hi Alice,

 

Bravos, tried your flows steps and it work but it also capture other text in the email.

So how  remove or ignore other text such as "Best Request"  and  email signature .

 

Best Regard,

NH

Hi Alice, new Flow user here!

 

I'm following your exact example and I have gotten my Flow to run successfully, however, it is not extracting the text properly for 2 lines.  I have checked and rechecked that all the references are typed exactly as they should be, I see nothing that says these lines should be extracted any differently than all the other ones that are working.  Any ideas?  Below is my code...lines that are underlined are the 2 giving me troubles.  Any help is greatly appreciated!

{
    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['shared_excelonlinebusiness']['connectionId']"
            }
        },
        "method": "post",
        "body": {
            "Request Date": "@{first(skip(split(first(split(body('Html_to_text'),'Sales Initials')),'Request Date'),1))}",
            "Sales Initials": "@{first(skip(split(first(split(body('Html_to_text'),'Client Name or Customer Code')),'Sales Initials'),1))}",
            "Client Name or Customer Code": "@{first(skip(split(first(split(body('Html_to_text'),'Project Address')),'Client Name or Customer Code'),1))}",
            "Project Address": "@{first(skip(split(first(split(body('Html_to_text'),'Bill To If Different')),'Project Address'),1))}",
            "Bill To If Different": "@{first(skip(split(first(split(body('Html_to_text'),'Floors or Suite Numbers')),'Bill To If Different'),1))}",
            "Floors or Suite Numbers": "@{first(skip(split(first(split(body('Html_to_text'),'Project Size and Complexity')),'Floors or Suite Numbers'),1))}",
            "Project Size and Complexity": "@{first(skip(split(first(split(body('Html_to_text'),'Major Systems Line')),'Project Size and Complexity'),1))}",
            "Major Systems Line": "@{first(skip(split(first(split(body('Html_to_text'),'Due Date for Design')),'Major Systems Line'),1))}",
            "Due Date for Design": "@{first(skip(split(first(split(body('Html_to_text'),'Designer Assigned')),'Due Date for Design'),1))}",
            "Designer Assigned": "@{first(skip(split(first(split(body('Html_to_text'),'_')),'Designer Assigned'),1))}"
        },
        "path": "/codeless/v1.2/drives/@{encodeURIComponent('b!4GvXZb_9JkaawUdl3L1dfsVz_dNQC3tNhS635iDouJTqvha8iTCgRqSFWYIPETWu')}/items/@{encodeURIComponent('01EXCIRQFR4K3VYZXTYBGLKVW3NDZYGJCG')}/workbook/tables/@{encodeURIComponent('{9072CD82-AADE-4CF7-BB94-C76DC549B63C}')}/rows",
        "queries": {
            "source": "me"
        },
        "authentication": "@parameters('$authentication')"
    },
    "metadata": {
        "01EXCIRQFR4K3VYZXTYBGLKVW3NDZYGJCG": "/New Design Requests.xlsx",
        "flowSystemMetadata": {
            "swaggerOperationId": "AddRowV2"
        }
    }
}

I had a similar task to do it but I have more row in a text file after extracting from HTML to text. I'm trying to understand the rules of expressions to solve my task by my self but I don't really understand it If some of you can help me with that task I would be appreciate of.

@vecerpa i am exactly looking for this and will ensure the input sent by email is structured so that it can be processed.

 

one question: the excel file (output) with the email info can be stored anywhere or it goes only to a sharepoint folder? I would need the first. thanks.

Anonymous
Not applicable

When I use these formulas and my data is inserted into a share point list , there is an additional leading space inserted with the text. Is there a way to strip the leading space?

GrandMaZzZBOY
Frequent Visitor

Here is something that worked for me. What you do is put your mouse cursor into that value field, press Enter on the keyboard so it adds the line/carriage return. Use PeekCode to verify, you should see character return code

Sorry this was my first post. Responded to wrong thread in wrong window.

Cool, thanks 

redacted due to sensitive information

Alice - If there is text that is not needed on the spreadsheet that is listed below the last field on the email, is there a way to prevent that from showing up?  my flow works except it adds additional text to the last field that isn't needed and I have to go in manually and delete it. 

marco_za
New Member

Hi 

 

I need help to extract from the following email:

 

"

From: Michael Ferreira <txxxxxxxxxx@gmail.com>

Subject: [your-subject]

 

Message Body:

I'm interested in buying the house

 

Phone Number: 000000000

 

--

This email was sent from a contact form on"

 

i need to extract the nme, email phone number and message.

 

thank you.

SSKS
New Member

Thank you for the example, I was able to create a power automate flow which works well for new emails arriving in my inbox.

 

Please suggest if there is a solution to create a similar power automate flow to extract data from emails in an outlook folder, to a spreadsheet? 

This solved my problem 100% - thank you for sharing!!!!

Anonymous
Not applicable

Hi Alice,

Your examples and solutions are wonderful! However, I am still struggling to get my head around the expressions. I tried using your method, but it does work on mine. Maybe because the email format is different. May I please request for you help to get the right expressions?

 

 

alkhan50
Helper I
Helper I

yes you can , If you need to extract any kind of data like email addresses, names , phone numbers , company names or any other information ( leads ) from emails. This website does it for free for upto few 100 emails https://haileads.com write to the team at info@haileads.com if u have a larger set of emails to be processed.

Helpful resources

Announcements

Update! June 13th, Community Ambassador Call for User Group Leaders and Super Users

Calling all Super Users & User Group Leaders   UPDATE:  We just wrapped up June's Community Ambassador monthly calls for Super Users and User Group Leaders. We had a fantastic call with lots of engagement. We are excited to share some highlights with you!    Big THANK YOU to our special guest Thomas Verhasselt, from the Copilot Studio Product Team for sharing how to use Power Platform Templates to achieve next generation growth.     A few key takeaways: Copilot Studio Cookbook Challenge:  Week 1 results are posted, Keep up the great work!Summer of Solutions:  Starting on Monday, June 17th. Just by providing solutions in the community, you can be entered to win tickets to Power Platform Community Conference.Super User Season 2: Coming SoonAll communities moving to the new platform end of July We also honored two different community members during the call, Mohamed Amine Mahmoudi and Markus Franz! We are thankful for both leaders' contributions and engagement with their respective communities. 🎉   Be sure to mark your calendars and register for the meeting on July 11th and stay up to date on all of the changes that are coming. Check out the Super User Forum boards for details.   We're excited to connect with you and continue building a stronger community together.   See you at the call!

Copilot Cookbook Challenge | Week 2 Results | Win Tickets to the Power Platform Conference

We are excited to announce the "The Copilot Cookbook Community Challenge is a great way to showcase your creativity and connect with others. Plus, you could win tickets to the Power Platform Community Conference in Las Vegas in September 2024 as an amazing bonus.   Two ways to enter: 1. Copilot Studio Cookbook Gallery:  https://aka.ms/CS_Copilot_Cookbook_Challenge 2. Power Apps Copilot Cookbook Gallery: https://aka.ms/PA_Copilot_Cookbook_Challenge   There will be 5 chances to qualify for the final drawing: Early Bird Entries: March 1 - June 2Week 1: June 3 - June 9Week 2: June 10 - June 16Week 3: June 17 - June 23Week 4: June 24 - June 30     At the end of each week, we will draw 5 random names from every user who has posted a qualifying Copilot Studio template, sample or demo in the Copilot Studio Cookbook or a qualifying Power Apps Copilot sample or demo in the Power Apps Copilot Cookbook. Users who are not drawn in a given week will be added to the pool for the next week. Users can qualify more than once, but no more than once per week. Four winners will be drawn at random from the total qualifying entrants. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once. If they are drawn multiple times, another user will be drawn at random. Prizes:  One Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value, does not include travel, lodging, or any other expenses) Winners are also eligible to do a 10-minute presentation of their demo or solution in a community solutions showcase at the event. To qualify for the drawing, templates, samples or demos must be related to Copilot Studio or a Copilot feature of Power Apps, Power Automate, or Power Pages, and must demonstrate or solve a complete unique and useful business or technical problem. Power Automate and Power Pagers posts should be added to the Power Apps Cookbook. Final determination of qualifying entries is at the sole discretion of Microsoft. Weekly updates and the Final random winners will be posted in the News & Announcements section in the communities on July 29th, 2024. Did you submit entries early?  Early Bird Entries March 1 - June 2:  If you posted something in the "early bird" time frame complete this form: https://aka.ms/Copilot_Challenge_EarlyBirds if you would like to be entered in the challenge.   Week 1 Results:  Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Copilot Cookbook Gallery:Power Apps Cookbook Gallery:1.  @Mathieu_Paris 1.   @SpongYe 2.  @Dhanush 2.   @Deenuji 3.  n/a3.   @Nived_Nambiar  4.  n/a4.   @ManishSolanki 5.  n/a5.    n/a   Week 2 Results:  Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Copilot Cookbook Gallery:Power Apps Cookbook Gallery:1. Kasun_Pathirana1. ManishSolanki2. cloudatica2. madlad3. n/a3. SpongYe4. n/a4. n/a5. n/a5. n/a

Win free tickets to the Power Platform Conference | Summer of Solutions

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**

Celebrating the June Super User of the Month: Markus Franz

Markus Franz is a phenomenal contributor to the Power Apps Community. Super Users like Markus inspire others through their example, encouragement, and active participation.    The Why: "I do this to help others achieve what they are trying to do. As a total beginner back then without IT background I know how overwhelming things can be, so I decided to jump in and help others. I also do this to keep progressing and learning myself." Thank you, Markus Franz, for your outstanding work! Keep inspiring others and making a difference in the community! 🎉  Keep up the fantastic work! 👏👏 Markus Franz | LinkedIn  Power Apps: mmbr1606  

Your Moment to Shine: 2024 PPCC’s Got Power Awards Show

For the third year, we invite you, our talented community members, to participate in the grand 2024 Power Platform Community Conference's Got Power Awards. This event is your opportunity to showcase solutions that make a significant business impact, highlight extensive use of Power Platform products, demonstrate good governance, or tell an inspirational story. Share your success stories, inspire your peers, and show off some hidden talents.  This is your time to shine and bring your creations into the spotlight!  Make your mark, inspire others and leave a lasting impression. Sign up today for a chance to showcase your solution and win the coveted 2024 PPCC’s Got Power Award. This year we have three categories for you to participate in: Technical Solution Demo, Storytelling, and Hidden Talent.      The Technical solution demo category showcases your applications, automated workflows, copilot agentic experiences, web pages, AI capabilities, dashboards, and/or more. We want to see your most impactful Power Platform solutions!  The Storytelling category is where you can share your inspiring story, and the Hidden Talent category is where your talents (such as singing, dancing, jump roping, etc.) can shine! Submission Details:  Fill out the submission form https://aka.ms/PPCCGotPowerSignup by July 12th with details and a 2–5-minute video showcasing your Solution impact. (Please let us know you're coming to PPCC, too!)After review by a panel of Microsoft judges, the top storytellers will be invited to present a virtual demo presentation to the judges during early August. You’ll be notified soon after if you have been selected as a finalist to share your story live at PPCC’s Got Power!  The live show will feature the solution demos and storytelling talents of the top contestants, winner announcements, and the opportunity to network with your community.  It's not just a showcase for technical talent and storytelling showmanship, show it's a golden opportunity to make connections and celebrate our Community together! Let's make this a memorable event! See you there!   Mark your calendars! Date and Time: Thursday, Sept 19th Location: PPCC24 at the MGM Grand, Las Vegas, NV 

Tuesday Tip | Accepting Solutions

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   To enhance our collaborative environment, it's important to acknowledge when your question has been answered satisfactorily. Here's a quick guide on how to accept a solution to your questions: Find the Helpful Reply: Navigate to the reply that has effectively answered your question.Accept as Solution: Look for the "Accept as Solution" button or link, usually located at the bottom of the reply.Confirm Your Selection: Clicking this button may prompt you for confirmation. Go ahead and confirm that this is indeed the solution.Acknowledgment: Once accepted, the reply will be highlighted, and the original post will be marked as "Solved". This helps other community members find the same solution quickly. By marking a reply as an accepted solution, you not only thank the person who helped you but also make it easier for others with similar questions to find answers. Let's continue to support each other by recognizing helpful contributions. 

Users online (2,811)