Live training: next batches coming soon. Join the waitlist:Waitlists open:Developer Training →Developer →Copilot Studio Training →Copilot Studio →

Remove Characters From String In Power Automate [with Examples]

When we create flows in Power Automate, it’s common to receive text that isn’t perfectly formatted, with extra spaces, unwanted characters, or parts of a string you don’t need. Cleaning the text before saving it to SharePoint, sending an email, or creating a file is essential.

In this tutorial, I will tell you how to remove characters from a string in Power Automate. Here I will cover:

  • Power Automate trim characters from a string to remove unwanted spaces or tabs.
  • Remove Characters with the Replace Function in Power Automate.
  • Strip out unwanted symbols with Power Automate and remove special characters.
  • Remove the first character in a string using Power Automate substring expressions.
  • Power Automate removes the last character for precise text formatting.
  • Remove the first and last characters together with a smart Power Automate substring trick.
  • Cut off extra text using Power Automate, remove the last N characters.
  • Remove multiple characters from a string in Power Automate.

Power Automate Trim Character From String

Before we dig deeper into the remove functions of Power Automate, let’s learn another important and mainly used trim function, how to trim characters from a string in Power Automate.

trim() function of Power Automate returns the string value without the leading and trailing whitespace.

Suppose you are collecting attendee details through a Microsoft Form named Event Registrations.

Power Automate trim function to remove leading and trailing spaces from string

Some people accidentally add extra spaces before or after their names, for example:

" Jon Patel "

Before saving these names into a SharePoint list, you need to clean them up so that they show “Jon Patel” without extra spaces.

Follow the steps below to Trim Characters in Power Automate:

  1. Go to Power Automate. Click on Create > Automated cloud flow. Name: Trim Character From String. Select trigger: When a new response is submitted. Select your Microsoft Form from the dropdown.
How to trim characters from text using Power Automate
  1. To retrieve the response, add the Get response details action from the Microsoft Forms connector. Then, select the Form ID from the dropdown menu and choose the Response ID from the dynamic content of the ‘When a new response is submitted’ trigger.
Power Automate expression to trim white space in a variable
  1. Add a compose action and provide the following expression:
trim(outputs('Get_response_details')?['Name'])
Power Automate example to trim tabs and line breaks from string
  1. Add a Create item action for your SharePoint list (or wherever you store registrations). In the Attendee Name column, insert the above compose action output.
Trim specific character from start and end of text in Power Automate

Save the flow and submit a new Event Registration with leading and trailing spaces in the name.