How to Convert Array to String in Power Automate

How to Convert Array to String in Power Automate

When working with Power Automate, you may encounter situations where data is stored in an array format, but a string output is required for emails, notifications, reports, or file generation.

Power Automate provides the join() expression, which allows you to combine multiple array elements into a single string using a specified delimiter.

Why Convert Arrays to Strings?

Using the join() Function

The join() function combines all values in an array into a single string.

join(
createArray('Apple','Orange','Banana'),
', '
)

Output:

Apple, Orange, Banana

Using Dynamic Array Values

You can convert arrays retrieved from SharePoint, Dataverse, Excel, or APIs into strings.

join(
variables('SelectedItems'),
', '
)

Using Different Delimiters

The delimiter can be customized based on requirements.

join(
variables('Departments'),
' | '
)

Example Output:

Sales | Marketing | Finance

Creating Email Content

Arrays are frequently converted into strings before sending email notifications.

concat(
'Selected Products: ',
join(
variables('Products'),
', '
)
)

Example Output:

Selected Products: Laptop, Mouse, Keyboard Important: The join() function works only with arrays. Ensure the input value is an array before applying the expression.

Common Use Cases

Best Practices

Key Takeaways