Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Extract Data From Email and Create Array Object



I have a e-commerce email that notifies me of any new orders, like so:




SKU 123456

QTY  5





I would like to process the order information so as to create an array object named "Order" with the text in bold as keys and the plain text as the values. I can,  in theory, place a delimeter between the two, (i.e SKU | 123456) to help with the split function, but have yet to find a way creat an array object and input the key value pairs as described above.

Resolver II
Resolver II

Hi @Mobutu1650 , 

I assume you're using the "when an email comes in" trigger.


You won't be able to do keypairs in an array as they're meant to be 1D. A riskier method would be creating 5 arrays and returning the pairings by [position], but I wouldn't recommend that.


There's an other variable type "object" which you could use.  Are you familiar with JSON? If the emails are always exactly the same, you could split by spaces and count which objects would be the value in the key-value pairs. Create 5 variables, then you would have an apply to each loop on the split(emailbody,' ') value and a Switch statement (like if, but with many else branches) to get your 5 values and then use a Compose step to build the JSON like this:


"SKU": "[value from variable]",

"QTY": "[value from variable]" 



Then you can set your object variable to the outputs of this Compose step

Frequent Visitor

Thanks, but unfortunately, the products in question have a massive amount of options/configurations that make parsing the email content and iterating through all possible if/else conditions somewhat tricky. Wondering if it would be just easier to split the bolded and plain text and throw it in column excel column or list...


Helpful resources

Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (3,531)