Power Automate Append to String Variable: Tested Guide

The append to string variable action in Power Automate adds text to the end of a String variable. Run it inside Apply to each with concat(item()?['Title'], decodeUriComponent('%0A')), and you build a multi-line list, one line per item.

In this tutorial, we’ll build a text summary in a loop, add line breaks and separators, and see what happens with numbers, objects, and parallel loops. I tested every case in a real flow in October 2026.

Append summary line run details in Power Automate with Name Summary and Value Website redesign (Seattle)
Each pass of the loop appends one line to the Summary variable

What Does Append to String Variable Do?

It takes the current text in a String variable and adds your value to the end. Nothing is replaced. If Summary holds Total: and you append 5, it becomes Total: 5.

Both fields are required: Name picks the variable, and Value is what gets added. Microsoft Learn says the value can have any type. My tests show how each type turns into text.

To replace the text instead, use the action that can set a variable in Power Automate. For numbers, use Increment variable.

How Do You Build a Text Summary Step by Step?

You need a Power Automate account and nothing else. The demo loops over six customer requests stored in an array variable, as in my guide to initialize an array variable with values.

  1. Go to make.powerautomate.com, select Create > Instant cloud flow, pick Manually trigger a flow, and select Create.
  2. Add Initialize variable for Requests (Array, six records with Title and City).
  3. Add another Initialize variable: Name Summary, Type String, Value left empty.
  4. Add Apply to each and choose the Requests variable.
  5. Inside the loop, select Add an action, search for append to string, and pick Append to string variable.

Choose Summary in Name. In Value, select the fx icon and enter this expression:

concat(item()?['Title'], ' (', item()?['City'], ')', decodeUriComponent('%0A'))
Power Automate expression editor with concat of Title, City and decodeUriComponent('%0A') for a line break
The Value expression adds the title, the city, and a line break

Here’s the action in Code view:

"Append_summary_line": {
  "type": "AppendToStringVariable",
  "inputs": {
    "name": "Summary",
    "value": "@concat(item()?['Title'], ' (', item()?['City'], ')', decodeUriComponent('%0A'))"
  },
  "runAfter": {
    "Set_LastCustomer": ["Succeeded"]
  }
}

What Does the Finished Text Look Like?

After the loop, my Summary variable held six lines. In the raw output, each line break shows as \n:

Power Automate raw output of the Summary string variable with \n line breaks between six request lines
Raw output: \n marks each line break in the JSON view

As plain text, it reads like this:

Website redesign (Seattle)
Payroll setup (Denver)
Quarterly audit (Austin)
Laptop refresh (Chicago)
Training plan (Boston)
VPN access (Phoenix)

The value also ends with one last line break. That’s harmless in an email, but trim it if the text goes into a field that cares. You’ll see how in a later section.

How Do You Add a Line Break to a String Variable?

Use decodeUriComponent('%0A'), which returns a line feed character. When I appended it to Seattle, the length went from 7 to 8, so one real character was added.

Typing \n doesn’t work. Appended to Seattle, it gave Seattle\n with a length of 9: a literal backslash and an n. Power Automate has no escape sequences in values.

For HTML emails, append <br> instead of a line feed. For a full layout, build an HTML table in Power Automate.

How Do You Join Items with a Comma and No Trailing Separator?

Appending concat(item(), ', ') for Seattle, Denver, and Austin gave Seattle, Denver, Austin, with an extra comma and space at the end.

Cut the last two characters after the loop with this expression. It returned Seattle, Denver, Austin:

substring(variables('AppList'), 0, sub(length(variables('AppList')), 2))

If the list could be empty, check its length first. Often it’s simpler to skip the loop: collect the values in an array and use join(array, ', '), which adds no trailing comma.

Going the other way, from text back to a list, is covered in my guide to creating an array from a string.

What Happens When You Append Numbers, Booleans, or Objects?

Each one became text. Some of the results surprised me:

Start valueAppendedResult
Total: 5Total: 5
Done: trueDone: True (capital T)
emptyjson('{"City":"Austin"}'){“City”:”Austin”}
emptycreateArray('a','b')[“a”,”b”]
xnullx (nothing added, no error)

The capital T matters if another step compares the text to true. Wrap that comparison in toLower(), or append the literal text true yourself.

Numbers append fine, but the variable stays text. To do math on it later, see how to convert a string to an integer.

Is Append to String Variable Safe in a Parallel Loop?

Nothing gets lost, but the order does. I appended the numbers 1 to 10 in Apply to each with concurrency at 10. All ten numbers arrived, but in this order:

Power Automate raw output of a string built in a parallel loop: 8 6 10 4 9 1 2 5 7 3 out of order
A parallel loop appended every number, but out of order

Microsoft Learn says Append to variable might return unpredictable results in parallel loops. Keep the loop sequential, the default, when line order matters, as in my guide to Apply to each on an array variable.

Why Not Use Set Variable with concat()?

A Set variable that uses its own value, like concat(variables('Summary'), 'more'), is refused when you save the flow. Power Automate reports that self reference isn’t supported.

Append to string variable does exactly that job without the error. The same idea applies to numbers, where you increment a variable by 1 instead of setting it.

What Happened in My Tests?

TestResult
6 requests with title, city, line feed6-line summary
Append decodeUriComponent('%0A')Length +1 (real line feed)
Append typed \nLiteral backslash + n
Append with ‘, ‘ in a loopTrailing ‘, ‘ left over
substring() trimSeattle, Denver, Austin
Append trueTrue
Append nullNo change
Parallel loop, 10 itemsAll 10 kept, order mixed

Append to String Variable: Cheat Sheet

GoalHow
Add text to the endAppend to string variable, Name + Value
New linedecodeUriComponent('%0A')
HTML line break<br>
Remove trailing ‘, ‘substring(v, 0, sub(length(v), 2))
No trailing separatorArray + join(array, ', ')
Keep line orderApply to each concurrency off
Replace the textSet variable

For more Power Automate patterns, the Power Automate tutorials hub lists every post in order.

Frequently Asked Questions

How do I append to a string variable in Power Automate?

Initialize a String variable, then add the Append to string variable action. Choose the variable in Name and put the text or expression to add in Value.

How do I add a new line when appending text?

Add decodeUriComponent(‘%0A’) at the end of the value, for example with concat(). Typing \n adds a backslash and an n, not a line break.

Can I append a number to a string variable?

Yes. The variables article on Microsoft Learn says the value can be any type. My test turned 5 into the text 5, and true became True.

Why is the order wrong after appending in a loop?

The Apply to each loop is running in parallel. Turn concurrency off in the loop’s Settings so the passes run one at a time.

How do I remove the last comma after appending in a loop?

Use substring(text, 0, sub(length(text), 2)) after the loop, or collect the values in an array and use join() instead.

More Power Automate Tutorials

Here are a few more posts to try next: