While working with Power Automate for one of my clients, there are many situations where you might need to split a string into an array. For example, you might receive a list of values separated by commas, spaces, or even line breaks. In such cases, you can use the split() function to break the string into individual parts and process them easily in your flow.
In this tutorial, I will explain how to use the split() function in Power Automate with various types of delimiters, including commas, spaces, and newlines. I will also show how to handle more advanced scenarios such as splitting using multiple delimiters, extracting text between two characters, and looping through the split array.
Let’s explore how to split a string into an array in Power Automate step by step with examples.
Split String Using the split() Function in Power Automate
In Power Automate, the split() function is used to break a string into an array based on a specific delimiter. This is helpful when you have a long string that contains multiple values separated by a character like a comma, space, colon, or any other symbol.
Syntax of the split() function:
split(text, delimiter)
- text: This is the full string you want to split.
- delimiter: This is the character or symbol where you want to split the string.
For example, let’s say you have the following string:
"Red-Blue-Green"
To split it using the hyphen (-) as the delimiter, use the expression:
split('Red-Blue-Green', '-')
This will return the array:
[
"Red",
"Blue",
"Green"
]

You can use this output directly in actions like Apply to each, or you can retrieve individual items from the array using their index.
Split String by Comma Separator using Power Automate
One of the most common scenarios in Power Automate is working with comma-separated values (CSV). For example, you might receive a list of email addresses, product names, or locations in a single string separated by commas. Using the split() function, you can easily break these values into an array and use them in our flow.
Now follow the steps below:
Suppose you receive the following string, which I added in the compose action:
"California,Texas,Florida,New York,Illinois"

To split this string into individual state names, use the following expression:
split(outputs('Compose'),',')

After the flow runs, you can see that this will return the array:
[
"California",
"Texas",
"Florida",
"New York",
"Illinois"
]

You can now loop through this array using the Apply to each action in Power Automate and perform actions like filtering data, sending emails, or creating SharePoint items for each state.
Tip:
If the items have extra spaces (“California, Texas”), use the trim() function to remove them: trim(items(‘Apply_to_each’))
Check out: Create a Multi-Agent in Copilot Studio
Split String by Space in Power Automate
Sometimes, you may receive a string that contains words separated by spaces. An everyday use case in Power Automate is splitting a full name into its first and last names. You can easily do this using the split() function with a space (‘ ‘) as the delimiter.
Let’s say your Power Automate flow receives a string like this:
"John Smith"
To split this into first and last name, follow these steps:
- Create an Instant cloud flow (with a manual trigger).
- Add a “Initialize variable” action:
- Name: FullName
- Type: String
- Value: John Smith

- Add another “Compose” action and use the split() Expression:
split(variables('FullName'), ' ')

This will return an array:
[
"John",
"Smith"
]
- To store the first and last names separately:
- Add a “Initialize variable” action:
- Name: FirstName
- Type: String
- Value: outputs(‘Compose’)?[0]
- Add a “Initialize variable” action:
- Name: LastName
- Type: String
- Value: outputs(‘Compose’)?[1]
- Add a “Initialize variable” action:

After that, click Save and then Run it manually. Once it runs successfully, open the Run History and check the values of the variables.

This technique is especially useful when you’re processing user data from a Microsoft Form, SharePoint list, or a custom app that collects full names in a single field.
Power Automate Split String by New Line
In some scenarios, especially when collecting data from Microsoft Forms or emails, you may receive multiple lines of text in a single field. Each line might represent a separate item, such as product names, city names, or notes. In Power Automate, you can split this string into an array using a new line as the delimiter.
Suppose a user submits the following multiline string in a form:
New York
Los Angeles
Chicago
Houston
Phoenix
You want to split this into individual city names.
Follow the steps below:
- Create an Instant cloud flow (with a manual trigger).
- Add a “Initialize variable” action:
- Name: cityName
- Type: String
- Value: Above value
- Add another “Initialize variable” action:
- Name: lineBreak
- Type: String
- Value: leaveblank

Read more: Add Copilot Studio Knowledge Files Using Power Automate
- Add a Compose action to split the string using a new line delimiter:
split(variables('cityName'),variables('lineBreak'))

Once you set up the actions, click Save and then Run the flow. After it runs, open the Run History and check the output of the Compose

You can also get the same thing using the following expression:
split(variables('cityName'),decodeUriComponent('%0A'))
Check out: Create Autonomous Agents in Copilot Studio
Split String Using Multiple Delimiters Using Power Automate
In some cases, you may receive a string that uses more than one type of separator, for example, a mix of commas, semicolons, and pipes. Power Automate’s split() function only supports one delimiter at a time, but with a bit of help from the replace() function, you can standardize the string before splitting it.
Let’s say your input string looks like this:
Texas;California|Florida,New York
This string uses three different delimiters: semicolon (;), pipe (|), and comma (,). To split it, you’ll first replace all the delimiters with a common one, like a comma, and then split the string.
Follow the steps below:
- Trigger the flow manually or through a form.
- Add an “Initialize variable” action:
- Name: StateList
- Type: String
- Value:
Texas;California|Florida,New York
- Add a Compose action to clean the string by replacing the other delimiters:
replace(replace(replace(variables('StateList'), ';', ','), '|', ','), ' ', '')

This replaces ‘;’ and ‘|’ with ‘,’ and removes any unwanted spaces.
- Add another “Compose” action to split the cleaned string:
split(outputs('Compose'), ',')

Output:

Split String and Loop Through Array in Power Automate
Once you split a string into an array in Power Automate, I want to loop through each item and perform actions, such as sending an email.
The best way to do this is by using the ‘Apply to each’ control option.
Suppose you have the following string of email addresses:
LidiaH@*****.onmicrosoft.com,PattiF@*****.onmicrosoft.com,MiriamG@*****.onmicrosoft.com
You want to split this string and send an email to each person individually.
- Create an Instant cloud flow. Add an “Initialize variable” action:
- Name: EmailList
- Type: String
- Value:
LidiaH@*****.onmicrosoft.com,PattiF@*****.onmicrosoft.com,MiriamG@*****.onmicrosoft.com
- Add a “Compose” action to split the string:
split(variables('EmailList'), ',')

- Add an “Apply to each” action:
- Select the output of the Compose action as the array to loop through.

Read: Create an Agent Flow Using Designer in Copilot Studio
- Inside the loop, add a “Send an email (V2)” action:
- To: trim(items(‘Apply_to_each’))
- Subject: Hello from Power Automate
- Body:
This is a test email sent using Power Automate.

Click Save, then Run the flow. After it finishes, check the Run History to verify that Power Automate sent separate emails to each address on the list.

Looping through a split string is one of the best ways to handle dynamic data in Power Automate. Whether you’re processing email addresses, product IDs, or form entries, combining split() with Apply to each gives you the flexibility to handle them one by one.
As you can see, Power Automate makes it incredibly easy to split a string into an array using the split() function. Whether you’re dealing with commas, spaces, new lines, or even multiple types of delimiters, you can use your flows to handle dynamic and structured data in a few simple steps.
You can split a string using any delimiter, hyphen, pipe, semicolon, or even custom symbols by just modifying the delimiter value in the split() expression.
You may also like:
- Send an Email with Attachments in Power Automate
- Extract Invoice Details From SharePoint Using AI Builder in Power Automate
- Retrieve Specific Item in Power Automate
- Send Email Reminders from a SharePoint List using Power Automate
- Send an Email with Attachments from Local Folder using Power Automate
- Send a Customized email when a new item is created in a SharePoint list using Power Automate

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.