web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Add multiple rows into...
Power Automate
Answered

Add multiple rows into an excel table based on an email text

(2) ShareShare
ReportReport
Posted on by 26
Hello everyone,
 
I am trying to build a flow in Power Automate, based on the email that I send I want add rows into an excel table containing the text information after the 'Description:' , ';HS code:' , 'Justification' and 'Company'. 
 
 
So far so good, the flow is working but.... not as expected. In the excel table it brings only the data marked in green. I would like to have also separate rows the data marked in red. I don`t know how to configure 'apply to each' function and I would need your support in that.
 
Below you can see how the flow is built
 
 
Thank you in advance for you help and guidance!
 
regards, Alin
 
Categories:
I have the same question (0)
  • Michael E. Gernaey Profile Picture
    53,429 Super User 2025 Season 2 on at
    Hi,
     
    Just to verify, you actually have 3 Sets of data, of which you want to turn 4 Lines (each box has 4 lines) into a new row
     
    However, does the Email always have 1,2 or 3 or more "records", aka 4 lines?
     
     
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    If the email always contains complete data sets in the same order, you can do something like this:
    1. Split lines and filter by relevant rows
    2. Chunk these rows by number of properties
    3. Capture the property value
     
     
    Filter array
    From
    split(outputs('Compose'), decodeUriComponent('%0A'))
    Filter
    @or(
    	startsWith(item(), 'Description:'),
    	startsWith(item(), 'HS code:'),
    	startsWith(item(), 'Justification:'),
    	startsWith(item(), 'Company:')
    )
     
    Select
    From
    chunk(body('Filter_array'), 4)
    Map Description
    trim(
    	substring(
    		item()[0],
    		add(indexOf(item()[0], ':'), 1)
    	)
    )
    Map HS Code
    trim(
    	substring(
    		item()[1],
    		add(indexOf(item()[1], ':'), 1)
    	)
    )
    etc.
     
    Result
    An array of objects that you can add to Excel
     
     
  • CU14081154-0 Profile Picture
    26 on at
    Hello all,
     
    sorry I was off for few days...
     
    Thanks Chriddle for you suggestion , I`ll try it up today.
     
    Hello FLMike, yes, the email can have from one up to dozens of records", aka 4 lines.
     
    Thanks & keep in touch!
     
    Regards,
    Alin
  • CU14081154-0 Profile Picture
    26 on at
    Hello Chriddle,
     
    how did you end up with this compose result?
     
     
    Thanks for answer!
    Alin
     
  • Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    If your email is plain text, just put its body into the Compose.
    If it's an HTML email, use the "HTML to text" action.
  • Suggested answer
    CU14081154-0 Profile Picture
    26 on at
    Thanks for guidance Chriddle!
     
    I have made few modifications into my table and also to the configuration. Now I have 5 data within a ”set” and I have amended also the mapping.
     
    chunk(body('Filter_array'), 5)



    Then I shall go for each ‘Body item’?


    Apply to each ‘current item’



    And then ‘add a row into a table’ but how do I identify which data shall be added in the table? For instance in the ‘Description’ filed shall I go for with:
    trim(first(split(last(split(outputs(‘Html_to_text’)?[‘body’], ‘Description:’)), ‘Customs  Code:)))

     
    Thanks a lot!!!
     
  • Verified answer
    Chriddle Profile Picture
    8,443 Super User 2025 Season 2 on at
    Why are you using two (nested) loops? You should only have one.
     
    Assuming you are looping over body('Select'),
    you can access the current element within the "Apply to each" with items('Apply_to_each').
    To get the description, just use:
    items('Apply_to_each')?['Description']
     
  • CU14081154-0 Profile Picture
    26 on at
    Thank you so much Chriddle !!!
     
    Thanks to your valuable help now I`m having all the data into the excel table.




Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard