removing Leading and Trailing spaces for Headers

krrishkrsna

Board Regular
Joined
Jan 31, 2009
Messages
84
hi

plz give me the solution in removing Leading and Trailing spaces and Extra spaces in between the word for table Headers in power query

thanks in advance
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
It can't be done with any available menu-option, but it can be done via the Advanced Editor, for example:

Code:
let
    Source = Table1,
    AdjustedHeaders = Table.TransformColumnNames(Source, each Text.Combine(List.Select(Text.Split(_," "), each _ <> "")," "))
in
    AdjustedHeaders
 
Upvote 0
OK.

The code works fine with me, so you must be doing something wrong.
For us is hard to judge, as you provide no real information.
 
Upvote 0
the mistake is that i used code as it is. i made small correction from AdjustedHeaders to #"AdjustedHeaders" = Table.TransformColumnNames(Source, each Text.Combine(List.Select(Text.Split(_," "), each _ <> "")," "))

now its working fine :). thanks once again
 
Upvote 0

Forum statistics

Threads
1,225,730
Messages
6,186,700
Members
453,369
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top