Append to String Variable
The "Append to string variable" action in Power Automate is used to add more text to an existing string variable without overwriting its current value. Think of it as taking a note and writing extra text at the end rather than starting fresh.
Key Points
Only works on variables of type string.
You cannot use it on uninitialized variables—you need to create a string variable first.
It is useful for building dynamic text, creating logs, or collecting multiple items into a single text value.
Step 1: Initialize the String Variable
Before appending, you need a string variable:
Set:
Name: MyString
Type: String
Value: "Hello"
Step 2: Append to the String Variable
Set:
Name: MyString
Value: " World!"
This will add " World!" to the existing "Hello" value.
Step 3: Using the String
You can now use the variable in emails, messages, or logs. For example:
Output:
Hello World!
Full Example Flow
Scenario: Collecting names of attendees in a list.
@{items('Apply_to_each')['Name']},
Output might be:
Person1, Person2, Person3,
Scenario: Collect Email Addresses from a SharePoint List
Suppose you have a SharePoint list of employees, and you want to collect all email addresses into a single string separated by commas.
Step 1: Initialize the String Variable
Action: Initialize variable
Name: AllEmails
Type: String
Value: "" (empty)
Step 2: Get Items from SharePoint
Action: Get items
This retrieves all employee records.
Step 3: Apply to Each Item
Action: Apply to each → value from Get items
Inside this loop:
Set:
@{items('Apply_to_each')['Email']},
This takes each employee's email and adds it to the AllEmails string, separated by commas.
Step 4: Use the Combined String
Action: Send an email
To:
AllEmails
Result:
If your SharePoint list has these emails:
[email protected]
[email protected]
[email protected]
Then after the flow runs, AllEmails will be:
[email protected], [email protected], [email protected],
You can then use a substring() expression to remove the trailing comma if needed:
substring(variables('AllEmails'), 0, sub(length(variables('AllEmails')), 2))
Tips
Always initialize the variable first.
Use Append when building a single combined string.
Use Set variable if you want to replace the value entirely.
To remove trailing separators (like the last comma), you can use substring() or trim() in expressions.
Append to Array Variable
Append to array variable in Microsoft Power Automate is an action used to add a new value or item to an existing array variable during a flow. It helps collect multiple pieces of data into a single list as the workflow runs.
1️⃣ Create the Array Variable First
Before you can append to an array, you must initialize it.
Configure:
Name: MyArray
Type: Array
Value:
[]
2️⃣ Add the Append to Array Variable Action
Configure:
Example:
{
"Name": "John",
"Age": 30
}
Each time the flow runs this step, the item gets added to the array.
3️⃣ Example Result
After multiple appends, the array becomes:
[
{ "Name": "John", "Age": 30 },
{ "Name": "Sara", "Age": 28 },
{ "Name": "Mike", "Age": 35 }
]
4️⃣ Common Use Cases
Collect items inside a loop
Build a JSON array
Combine results from multiple actions
Prepare data for API calls
Typical pattern inside a loop:
Initialize Array
↓
Apply to each
↓
Append to array variable
↓
Use final array
Collect Emails from a SharePoint List
Scenario
You have a SharePoint Employee List like this:
Goal:
Create a flow that collects all emails into one array and later sends an email to them.
Step 1 — Trigger
Create a flow with a trigger.
Example:
Manual trigger
When an item is created
Step 2 — Get Items from SharePoint
Add action:
Get items
Settings:
Output example:
[
{Name:"Person1", Email:"[email protected]"},
{Name:"Person2", Email:"[email protected]"},
{Name:"Person3", Email:"[email protected]"}
]
Step 3 — Initialize Array
Add action Initialize variable
| Field | Value |
|---|
| Name | EmailArray |
| Type | Array |
| Value | [] |
Current array:
[]
Step 4 — Apply to Each
Add Apply to each
Input:
value (from Get Items)
This loops through each employee.
Step 5 — Append Email to Array
Inside the loop add Append to array variable
| Field | Value |
|---|
| Name | EmailArray |
| Value | Email |
Expression example:
items('Apply_to_each')?['Email']
Step 6 — Result After Loop
Array becomes:
[
"[email protected]",
"[email protected]",
"[email protected]"
]
Step 7 — Use the Array
Now you can use the array in Send an Email action.
Example:
To field:
join(variables('EmailArray'), ';')
Result:
[email protected];[email protected];[email protected]
Final Flow Structure
Trigger
↓
Get Items (SharePoint)
↓
Initialize Array (EmailArray)
↓
Apply to Each
↓
Append to Array Variable
↓
Send Email
What Append to Array Did
It collected emails like this:
[]
↓
["[email protected]"]
↓
["[email protected]","[email protected]"]
↓
["[email protected]","[email protected]","[email protected]"]
Conclusion
'Append to String' and 'Append to Array' in Power Automate lets you easily build dynamic text and collections, making your flows more flexible and powerful.