Forum Discussion
Auto-rename all Query columns e.g. to remove underscore
Hi mike_honey,
We're still working on updating our documentation. Next time you needed a library function that doesn't appear in the documentation, try typing
= #shared
to the Power Query's formula bar like I suggested to greggyb. But 99% of the time, the function is already mentioned in a nicer way in the documentation, so that should be the first try.
About how to use it, there's some explanation and an example when you type
= Table.TransformColumnNames
to the PQ formula bar. In your case, it should probably look like this:
= Table.TransformColumnNames(table, (columnName as text) as text => Text.Replace(columnName, "_", ""))
It is up now, thanks everyone https://msdn.microsoft.com/en-us/library/mt674878.aspx
- mike_honey10 years agoMemorable Member
thanks arify - at least that function is exposed now. I found your last example in the thread above much more useful than the one posted in the documentation. That scenario (special characters in column headings) seems very unlikely.
Anyway I had to loop back to this to do something similar - inserting spaces for "Camel Case" column names e.g. CustomerName. So I have built a couple of examples using Table.TransformColumnNames and added it to my list of demo files (link below) for future reference - it's the one named:
Power Query demo - Renaming Columns automatically
- arify10 years agoMicrosoft Employee
mike_honey I just downloaded it and tried it out, it's pretty cool! I want to look around at that folder some time :)
- thephotobus7 years agoFrequent Visitor
mike_honey - would love to see this demo file. I checked, but perhaps it's no longer in the OneDrive location? Any way for me to access it?
Thanks,
Ryan
- mike_honey7 years agoMemorable Member
thephotobus - its still there. Try the button at top-right to change to list view.