Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Get the “next line after” in an array with Power Automate

Posted on June 2, 2024June 2, 2024 by Tom

“I’m parsing data from an email but the information is always on the next line after specific string, how to extract it in Power Automate?”


When you parse an email, there’re at least two ways how the data can be formatted – a block of text or a table. While it’s quite easy to find the desired information in a text, it’s a bit more complicated with the table. Converting an HTML table into text will turn each column into a separate line. The identifier is on one line, the value on the other…

In the past I used xpath(…), but that solution feels too complicated now. This article will show you another, much simpler approach. A few steps to find a specific line in an array, and extract the value from the next one.

Start from the array

The beginning is the as with a block of text – you need an array. If you already have an array, you can skip this step. If you’re parsing an email, turn it into a text and split by the new line character.

split(body('Html_to_text'),decodeUriComponent('%0A%0A'))

You’ll get an array where each line represents a table cell. In the example below there’s the identifier (Name, Company, Email) with the data on the next line.

Power Automate next line after

Extract data from “the next line”

If everything was on the same line, you’d extract it easily with the ‘Filter array’ action. But it’s not. Filtering the array won’t help.

Instead, turn it into a single string with a separator, e.g. ##, using the join(…) expression.

join(outputs('Compose'),'##')

It’s this long string with a clear distinction between the data rows where you can do the extraction.

Power Automate next line after

Firstly, split it by the data identifier and the separator, e.g. the Name##. That way you can remove everything before that, including the identifier.

split(outputs('Compose_-_single_string_with_separators'),'Name##')[1]

Now, when the string starts with the actual value, you have to remove everything after. Since you added a separator between the rows, you can now use it to take everything before its first occurrence.

Split(…) it again, this time using only the separator and keeping the first part.

split(split(outputs('Compose_-_single_string_with_separators'),'Name##')[1], '##')[0]

That’s it, you just extracted the value on the next line after ‘Name’.

Power Automate next line after

Summary

There’re two options to extract a specific piece of data in a flow – the ‘Filter array’ action or an expression. The ‘Filter array’ is great if everything is on a single line, but if it’s more complicated, if you need to get the next line after an identifier, it’s better to combine a few Power Automate expressions. Instead of an array that’s hard to dynamically navigate turn it into a string. Then it’s just a few split(…) expressions with indexes that’ll give you the value.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes