Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

How to refresh data from excel ?

How to refresh data from excel ?

 

I add new column and edit column name in file excel.

Please guide me about it.

  • Hi Anonymous ,

     

    If you add a new column in your excel file after importing data into Power BI, the new column won't be imported into Power BI after refreshing.

    One workaround, try to change the query like this:

    let
        Source = Excel.Workbook(File.Contents("D:\test.xlsx"), null, true),
        #"Removed Other Columns" = Table.SelectColumns(Source,{"Data"}),
        #"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", 
            Table.ColumnNames(Table.Combine(#"Removed Other Columns"[Data])),
            Table.ColumnNames(Table.Combine(#"Removed Other Columns"[Data]))
        ),
        #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true])
    in
        #"Promoted Headers"

     

    But there is a disadvantage: the types of all columns will need to defect manually.

     

     

    Best regards

    Icey

     

    If this post helps, then consider Accepting it as the solution to help other members find it faster.

2 Replies

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    If you add a new column in your excel file after importing data into Power BI, the new column won't be imported into Power BI after refreshing.

    One workaround, try to change the query like this:

    let
        Source = Excel.Workbook(File.Contents("D:\test.xlsx"), null, true),
        #"Removed Other Columns" = Table.SelectColumns(Source,{"Data"}),
        #"Expanded Data" = Table.ExpandTableColumn(#"Removed Other Columns", "Data", 
            Table.ColumnNames(Table.Combine(#"Removed Other Columns"[Data])),
            Table.ColumnNames(Table.Combine(#"Removed Other Columns"[Data]))
        ),
        #"Promoted Headers" = Table.PromoteHeaders(#"Expanded Data", [PromoteAllScalars=true])
    in
        #"Promoted Headers"

     

    But there is a disadvantage: the types of all columns will need to defect manually.

     

     

    Best regards

    Icey

     

    If this post helps, then consider Accepting it as the solution to help other members find it faster.