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.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,884)