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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

March 2024 FBC Gallery Image

Fabric Monthly Update - March 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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