Showing results for 
Search instead for 
Did you mean: 

Alteryx Designer Knowledge Base

Definitive answers from Designer experts.
Announcement | We'll be doing maintenance between 9am-11am MT on Saturday, January 25th, which may impact your experience. Thanks for your patience as we work on improving the community!

How To: Remove Leading/Trailing/All Whitespace

Community Data Engineer
Community Data Engineer
Created on

There are a couple of different whitespace situations you might get yourself into, but the schematic below (from the attached example Remove Whitespace.yxmd) has you covered in all of them:



Removing Whitespace.PNG


Most of the approaches make use of the Formula Tool’s trim() function which, without a second argument, defaults to trimming whitespace from your strings. You can also use the Data Cleansing tool to clean your fields for you!  Master it here.

Thanks MattD the regex_replace did the trick for me. Thank you for sharing

Hi, how do we stop Alteryx from removing string spaces automatically?

I've created a Python script to read input excel files,  but when i have sheet names with trailing spaces, Alteryx removes them automatically on the output. 

The Python throws, for example "DESKTOP EG "

Using the same script in Alteryx throws "DESKTOP EG",

Then if i want to read that sheet in another macro with a Dynamic Input, i cannot, because the space was removed, so an error message appears: 
"Record #1...does not match a sheet or named range in ... or the Excel file is corrupt.
How can i prevent that? Thank you.


Hi jcardoso,


I am having the same problem as you.


Did you ever find a solution?