Forum Discussion

MarkJF's avatar
MarkJF
Frequent Visitor
9 years ago
Solved

Programmatically change the case of headers (from a csv file)

Hi

 

I created a detailed report Report with data from csv files, and the Promoted Headers function provided me with headers all in lower case.

I now need to change the Source of the files, and the new files all have the Headers names in UPPer case; is there a way to select the first row of the imported table and convert it to Upper case before the Promoted Headers command?

 

Maybe using Table.SelectRows or similar commands?

 

Thanks

 

Mark

  • Or just change the column headers:

     

    let
        Source = #table(2,{{1,2}}),
        HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)
    in
        HeadersUpperCase

4 Replies

  • pawel1's avatar
    pawel1
    Icon for Kudo Kingpin rankKudo Kingpin

    Hi,

    maybe there is another way, but I would do it in the 3 simple steps:

    1. Transpose columns/rows

    2. Format items in the headers column to Upper Case

    3. Transpose back columns/rows

     

    1. Transpose column to rows2. Format items in 'header' column to UPPer Case3. Transpose back rows to columns

     

     

    • MarcelBeug's avatar
      MarcelBeug
      Icon for Community Champion rankCommunity Champion

      Or just change the column headers:

       

      let
          Source = #table(2,{{1,2}}),
          HeadersUpperCase = Table.TransformColumnNames(Source,Text.Upper)
      in
          HeadersUpperCase
      • MarkJF's avatar
        MarkJF
        Frequent Visitor

        Thanks, now I can see the function Table.TransformColumnNames it all makes sense!

         

        (I think the transpose method might work as well, but my table has thousands of rows which might be an issue.)

         

        regards

         

        Mark