Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
suidino2
Frequent Visitor

Dataflow to lakehouse, bulk change header to appropriate format

In my scenario, many current data source table has space in the header name. I understand that when loading data to Lakehouse, table header can not have space in it. Is there a way to bulk fill the header space? Or any other function that can change header to appropriate format? 

1 ACCEPTED SOLUTION
miguel
Community Admin
Community Admin

Hi,

There's a couple of things that you can do to tackle this. 

 

The UI way

  • Reference your query twice miguel_6-1685163764002.png

     

  • In both references make sure to demote the headers miguel_0-1685163327601.png

     

  • Let's say that one of the referenced queries will be called "Headers" and the other one will be "Data"
    • For the Headers query:
      • Keep only the top 1 row miguel_1-1685163430190.png

         

      • Apply the "Replace values" transform to every single column in your query miguel_2-1685163500339.png
    • For the Data query:
      • Remove the top 1 row miguel_3-1685163582881.png

         

    • Append the Headers and Data query in that exact order miguel_4-1685163689308.png

       

    • Promote the first row to be the headers of the column miguel_5-1685163726980.png

       

    • Remove the now top 1 row of the table

miguel_8-1685163835803.png

 

The M script way requires you to first use Table.ColumnNames to get the list of columns of your table, then use a function like List.Transform to establish how you'd like to transform such list of columns and then the use those two pieces to pass the arguments required for the Table.RenameColumns function and perhaps using the List.Zip function to create that list of lists (of previous and new column names).

 

Let us know if this helps!

 

View solution in original post

1 REPLY 1
miguel
Community Admin
Community Admin

Hi,

There's a couple of things that you can do to tackle this. 

 

The UI way

  • Reference your query twice miguel_6-1685163764002.png

     

  • In both references make sure to demote the headers miguel_0-1685163327601.png

     

  • Let's say that one of the referenced queries will be called "Headers" and the other one will be "Data"
    • For the Headers query:
      • Keep only the top 1 row miguel_1-1685163430190.png

         

      • Apply the "Replace values" transform to every single column in your query miguel_2-1685163500339.png
    • For the Data query:
      • Remove the top 1 row miguel_3-1685163582881.png

         

    • Append the Headers and Data query in that exact order miguel_4-1685163689308.png

       

    • Promote the first row to be the headers of the column miguel_5-1685163726980.png

       

    • Remove the now top 1 row of the table

miguel_8-1685163835803.png

 

The M script way requires you to first use Table.ColumnNames to get the list of columns of your table, then use a function like List.Transform to establish how you'd like to transform such list of columns and then the use those two pieces to pass the arguments required for the Table.RenameColumns function and perhaps using the List.Zip function to create that list of lists (of previous and new column names).

 

Let us know if this helps!

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

November Update

Fabric Monthly Update - November 2024

Check out the November 2024 Fabric update to learn about new features.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.