cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mikael1
Level: Powered On

Email text to rows in excel spreadsheet

Hello!

I’m throwing myself in to a new world of string and substring in my quest for completing email text to rows in excel spreadsheet. But the problem is that I’m new at this and I can’t get it right

Email looks like this (html):

customer:             Company1
assignment:           Styr
Number:                35557
Form:                    hire
spec:                     19/11-19
press:                    10/12-19
Start:                     2 jan 2020
Price/h:                 450
TB:                        300
TG%:                     10%
KA:                        namn name
Name KA:              name name
PA:                        name name
City:                      Oslo
Order:                   namn
area:                     IT

 

Spreadsheet has the same amount of columns as above

The Flow:

  1. When new email arrive
  2. HTML to Text -> body
  3. Insert a new row in table -> orders.xlsx

 

I tried to use matching regular expression but that fails on emails that is html. I tried:  first(skip(split(first(split(body('Html_t….  But I´m no confident on using Flow/Power automate expression (fx)

 

Could someone give me a direction and a start on how to get this right?

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Email text to rows in excel spreadsheet

Hey @Mikael1 

 

Yes. It will involve a lot of string manipulations and might break just in case a line misses some identifier or a delimiter.You can check the sample below: 

 

S1.PNG

 

S2.PNG

 

S3.PNG

 

Expressions: 

1. split(outputs('Compose'),variables('enter'))
2. split(items('Apply_to_each'),':')

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: Email text to rows in excel spreadsheet

Hey @Mikael1 

 

There are a lot of string manipulations that you will have to do for this. Beginning with, you can start splitting each line on the enter key and then each item in this array (basically every line on the enter key) to be split on a space or a ':' and then use the string to populate the excel. 

 

You can initialize a string variable and hit an enter there to add it later to the split expression. something like I have shown here: https://powerusers.microsoft.com/t5/Microsoft-Flow-Community-Blog/10-MS-Flow-hacks-troubleshoots-wor... 

 

And then use the apply to each control for each line item and again split on a space key or a ':'. 

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Mikael1
Level: Powered On

Re: Email text to rows in excel spreadsheet

Thanks @yashag2255 

 

From what I could tell this will be a lot of work to get this right. 

Could you give me any example for the 2 first rows?

 

Best regards

Micke

Dual Super User
Dual Super User

Re: Email text to rows in excel spreadsheet

Hey @Mikael1 

 

Yes. It will involve a lot of string manipulations and might break just in case a line misses some identifier or a delimiter.You can check the sample below: 

 

S1.PNG

 

S2.PNG

 

S3.PNG

 

Expressions: 

1. split(outputs('Compose'),variables('enter'))
2. split(items('Apply_to_each'),':')

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,267)