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?
- Create readable email content
- Generate reports
- Store values in text fields
- Format notifications
- Prepare data for external systems
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, BananaUsing 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 | FinanceCreating 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
- Email notifications
- Approval workflows
- Report generation
- Dataverse text fields
- SharePoint updates
- API integrations
Best Practices
- Validate array contents before conversion.
- Choose meaningful delimiters.
- Handle empty arrays gracefully.
- Use join() instead of loops when possible.
- Test output formatting thoroughly.
Key Takeaways
- join() is the primary function for converting arrays to strings.
- Custom delimiters can be used to format output.
- Works with dynamic arrays from multiple data sources.
- Useful for emails, reports, and integrations.
- Simplifies data transformation in Power Automate.