Yes, Power Automate can split outputs using the split() expression, which divides a string into an array based on a delimiter, and you can also split arrays or collections with the union() function or by using the Apply to each control. The most direct way is to use the expression split(' in any action that accepts dynamic content, such as a Compose action or a variable.
What Does Splitting Outputs Mean in Power Automate?
In Power Automate, an output is any data that flows from one action to another—a response from a SharePoint list, an email body, a JSON object from an API, or a text string. Splitting that output means breaking it into smaller, more manageable pieces. The two common scenarios are:
- Splitting a string into an array of substrings using a delimiter (e.g., comma, semicolon, newline).
- Splitting an array into individual items so you can process each one separately, often using the Apply to each action.
The split() expression handles the first case. For the second, you typically don’t need a function—you just reference the array output directly in an Apply to each loop.
How to Use the split() Expression
The syntax is straightforward: split('', '. The input can be a literal string, a dynamic content reference, or even another expression. The delimiter can be a single character or a multi-character string.
Here’s a step-by-step example:
- Add a Compose action to your flow.
- In the Inputs field, enter the expression:
split('apple,banana,cherry', ',') - Run the flow. The output will be an array:
["apple", "banana", "cherry"]
To use dynamic content, replace the literal string with a dynamic token. For example, if you have a variable named EmailList containing john@example.com;jane@example.com, you would use split(variables('EmailList'), ';').
The delimiter can be a newline character. In Power Automate expressions, you can represent a newline as \n (backslash n) or use the char(10) function. For example, to split a multi-line text field on line breaks: split(body('Get_item')?['Description'], '\n').
How to Choose the Right Delimiter
Choosing the wrong delimiter is the most common mistake. Before splitting, inspect your data. If you’re splitting a CSV-style string, commas are typical, but if the data itself contains commas (e.g., addresses), you’ll need a different delimiter or a more robust parser.
- Comma – common for simple lists.
- Semicolon – often used when commas appear in the data.
- Pipe (|) – a safe choice when both commas and semicolons appear.
- Newline – for splitting lines of text.
- Tab – for TSV data.
If your data has no consistent delimiter, consider using a different approach like parsing JSON or using the substring() function with known positions, though that’s more complex.
Common Problems and How to Fix Them
Several issues arise when splitting outputs:
- Empty strings in the array: If your delimiter appears consecutively (e.g.,
a,,b),split()returns empty entries. You can filter them out using thewhere()function or by using the Filter array action. - Whitespace around items: After splitting, items may have leading/trailing spaces. Use the
trim()function inside a Select action to clean them. - Delimiter not found: If the delimiter isn’t present,
split()returns an array with the entire string as a single element. This is often unexpected—check your data. - Case sensitivity:
split()is case-sensitive. If your delimiter might appear in different cases, consider normalizing the input first withtoLower().
For example, to remove empty entries from a split result, you can use: where(split('a,,b', ','), item() != '') which returns ["a", "b"].
Alternatives to split() for Complex Scenarios
Sometimes split() isn’t enough. Here are alternatives:
- Parse JSON: If your output is JSON, use the Parse JSON action to convert it into a structured object, then reference properties directly.
- Filter array: If you have an array and need to split it into groups based on a condition, use the Filter array action.
- Select: To transform each element of an array (e.g., trim whitespace), use the Select action with an expression.
- union(): To combine arrays (which effectively splits merging), use
union().
For example, if you have a comma-separated string with extra spaces, you can split and trim in one step using a Select action: trim(item()) as the expression.
Cost and Performance Considerations
Splitting outputs itself doesn’t incur extra cost—it’s just an expression. However, the actions you use after splitting (like Apply to each) count against your action limits and API request limits. Each iteration in an Apply to each is a separate action. If your split produces a huge array (e.g., thousands of items), that could slow down your flow and consume many API calls.
To optimize:
- Avoid splitting large strings unnecessarily.
- Use Filter array before an Apply to each to reduce the number of items.
- Consider using Concurrency control on the Apply to each to run iterations in parallel, but be aware of rate limits.
Frequently Asked Questions
How do I split a string by newline in Power Automate?
Use the expression split(variables('MyText'), '\n') or split(variables('MyText'), char(10)). The char(10) function represents the line feed character. If your text uses carriage return + line feed (Windows style), use split(variables('MyText'), '\r\n').
Can I split a number or an integer?
No, split() only works on strings. If you have a number, convert it to a string first using the string() function, then split. For example, split(string(12345), '') would split into individual digits, but that’s rarely useful.
Why is my split output showing as an array but I can’t use it in a condition?
Arrays cannot be directly compared to a string in a condition. You need to first check if the array contains a value using the contains() function or iterate through it. For example, contains(split('a,b', ','), 'a') returns true.
How do I split a SharePoint multi-line text field?
Multi-line text fields often contain newline characters. Use split(body('Get_item')?['Description'], '\n') to get an array of lines. Make sure the field is a plain text field, not rich text, as rich text may include HTML tags.
What is the difference between split() and the ‘Split’ data operation?
There is no separate ‘Split’ data operation in Power Automate. The only way to split strings is using the split() expression. The Data Operation actions include Compose, Select, Filter array, Create CSV table, and Parse JSON, but not a dedicated split action.
Can I split an array into multiple arrays?
Yes, you can use the Filter array action multiple times, each with a different condition, to create separate arrays. For example, split a list of numbers into even and odd arrays. Alternatively, use the where() function in a Compose action.
Related
- Power Automate Split Flow: How to Branch Conditions
- Cell Counting Equation: Hemocytometer & Alternatives
- How to Create Shortcut Keys in Windows
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Embed Vimeo Videos in PowerPoint for PresentationsTo embed a Vimeo video in PowerPoint, open the slide in the desktop app, choose Insert > Video…
- Box and Whisker Plot in Excel: A Step-by-Step GuideTo build a box and whisker plot in Excel for Microsoft 365 on Windows, arrange each data group…
- How to Insert a Fillable Checkbox in Microsoft WordTo add a fillable checkbox in Word, turn on the Developer tab, place your cursor where the box…
- Excel Text Overflow: How It Works and How to Control ItYes. In Excel, text can visually overflow into the cell to its right when that neighboring cell is…
- Open a DB File in Excel: Methods, Limits, and OptionsYou usually cannot open a file ending in .db directly in Excel: the extension does not identify a…
- What Number Column Is Z in Excel?Column Z is column number 26 in Excel. The letters run from A as column 1 through Z…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.