Remove multiple spaces from column names words

I have an excel in which the column names can contain multiple spaces between them.
For ex: Invoice Data is written as Invoice Data (multiple space).
I want to rename such columns with proper names by only keeping one space between each word.

Hi @SunnyJha

Use this Expression to remove the spaces: Regex.Replace(STR, " {2,}", " ")
Iterate through the column names

Input Screenshot:
image

Solution
RemoveSpacesFromColumns.xaml (9.1 KB)
Sample.xlsx (8.7 KB)

Output Screenshot:
image

The solution attached will replace all the column names in your file with single spaces and remove the additional Space at the end of column name as well.

Thanks
Happy automatioN!

1 Like

Hi @SunnyJha

Can you share sample input and expected output.

Regards

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.