cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
petermachacha
New Member

Extracting data from email to excel

hi guys, i have been trying to automate a process where i receive a payment and enter the payment into an excel sheet, details that need to be entered are name, amount paid, transaction ID, and the time and date of payment. below is a sample of the confirmation message i receive after a payment is made.

 

Incoming - +263164 (Contact undefined)
Message text: You have received RTGS$900 from FUNGIRAI CHIGOMBE. Approval Code: MP211119.1735.K22953. New wallet balance: RTGS$66494.59. (11/19/21 17:35

 

i used power automate (im new to it) to automate the process, but the problem is that i cant seem to get the html code right to extract the info that i need, can anyone help?,

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @petermachacha 

I set up a flow, you can refer to the screenshots below to see if it helps.

This is my test email content.

vLilyWmsft_9-1637633801547.png

Trigger flow when the subject contains specific content.

vLilyWmsft_0-1637633409519.png

vLilyWmsft_1-1637633502697.png

Add Compose action, and change the name of the action to Incoming.

vLilyWmsft_2-1637633530773.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Incoming -')),'Message text')))

vLilyWmsft_3-1637633548058.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Message text:')),'Approval Code')))

vLilyWmsft_4-1637633597553.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Approval Code:')),'New wallet balance')))

vLilyWmsft_5-1637633624971.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'New wallet balance:')),'Payment Date')))

vLilyWmsft_7-1637633690323.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Payment Date:')),'Best Regards')))

vLilyWmsft_6-1637633660035.png

vLilyWmsft_10-1637633846287.png

When I receive the email, the info will be added into excel.

vLilyWmsft_11-1637633903851.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
BruKn0ws
New Member

Hi! I had the same issue you are having and the best way I solved it was by using an API to extract all the data you need. Depending on the platform you are using, I'd highly recommend looking into this as you can extract all your sales data in one go.

 

For my example, I use Shopify and automate.io to extract the data into an excel or google sheets worksheet.

https://www.youtube.com/watch?v=OfwBu1FRHS8&t=293s - using API connnector and Google Sheets

https://www.youtube.com/watch?v=rT9BWhOJk7g - Shopify API extraction using automate.io

 

hope it helps.

 

 

Sending a

petermachacha
New Member

@BruKn0wsthanks for the feedback. I checked out automate.io, added outlook and excel to my bot, got email from excel and set to add row, but the problem is that is there a way to get specific data from the email body. Im lost help, tried and failed.

Hi @petermachacha 

I set up a flow, you can refer to the screenshots below to see if it helps.

This is my test email content.

vLilyWmsft_9-1637633801547.png

Trigger flow when the subject contains specific content.

vLilyWmsft_0-1637633409519.png

vLilyWmsft_1-1637633502697.png

Add Compose action, and change the name of the action to Incoming.

vLilyWmsft_2-1637633530773.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Incoming -')),'Message text')))

vLilyWmsft_3-1637633548058.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Message text:')),'Approval Code')))

vLilyWmsft_4-1637633597553.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Approval Code:')),'New wallet balance')))

vLilyWmsft_5-1637633624971.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'New wallet balance:')),'Payment Date')))

vLilyWmsft_7-1637633690323.png

Expression:

trim(first(split(last(split(outputs('Html_to_text')?['body'],'Payment Date:')),'Best Regards')))

vLilyWmsft_6-1637633660035.png

vLilyWmsft_10-1637633846287.png

When I receive the email, the info will be added into excel.

vLilyWmsft_11-1637633903851.png

Hope the content above may help you.

Best Regards

If my solution helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,082)