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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
hsampath81
Frequent Visitor

Power BI Data Flow Refreshing issue when change the column of the excel file located in SharePoint

Loading data from excel file whare located in SharePoint but Number of columns are uneven

Excel sheet 1

hsampath81_0-1670937924671.png

Excel Sheet 2

 

hsampath81_1-1670937960004.png

City 1 is missing of the Excel sheet 2 

 

I am loading this excel sheet to Power BI Dataflow using following M Queries

 

let
  #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "Sample")),
  #"Filtered hidden files" = Table.SelectRows(#"Filtered Rows", each [Attributes]?[Hidden]? <> true),
  #"Invoke custom function" = Table.AddColumn(#"Filtered hidden files", "Transform file (7)", each #"Transform file (7)"([Content])),
  #"Renamed columns" = Table.RenameColumns(#"Invoke custom function", {{"Name", "Source.Name"}}),
  #"Removed other columns" = Table.SelectColumns(#"Renamed columns", {"Source.Name", "Transform file (7)"}),
  #"Expanded table column" = Table.ExpandTableColumn(#"Removed other columns", "Transform file (7)", Table.ColumnNames(#"Transform file (7)"(#"Sample file (7)"))),
  #"Transform columns" = Table.TransformColumnTypes(#"Expanded table column", {{"ID", type text}, {"Description", type text}, {"Qty", type text}, {"Value", type text}, {"Date", type text}, {"City1", type text}, {"City2", type text}}),
  #"Replace errors" = Table.ReplaceErrorValues(#"Transform columns", {{"ID", null}, {"Description", null}, {"Qty", null}, {"Value", null}, {"Date", null}, {"City1", null}, {"City2", null}})
in
  #"Replace errors"
 
 
 
But  when it is refresh it give an error
 
hsampath81_2-1670938154731.png

 

How do we refresh Power BI Data flow from the dynamic Datasource(Number of column change of the excel sheet)

 

Regards,

Harsha

 

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

The two last steps specifically reference the City1 column. This updated query should avoid that.

let
    Source = SharePoint.Files(
        "https://Abcroup.sharepoint.com/teams/DataVisualizationandDashboards519-HandoverfromSanduni",
        [
            ApiVersion = 15
        ]
    ),
    #"Filtered Rows" = Table.SelectRows(Source, each Text.StartsWith([Name], "Sample")),
    #"Filtered hidden files" = Table.SelectRows(#"Filtered Rows", each[Attributes]?[Hidden]? <> true),
    #"Invoke custom function" = Table.AddColumn(
        #"Filtered hidden files", "Transform file (7)", each #"Transform file (7)"([Content])
    ),
    #"Renamed columns" = Table.RenameColumns(#"Invoke custom function", {{"Name", "Source.Name"}}),
    #"Removed other columns" = Table.SelectColumns(#"Renamed columns", {"Source.Name", "Transform file (7)"}),
    #"Expanded table column" = Table.ExpandTableColumn(
        #"Removed other columns", "Transform file (7)", Table.ColumnNames(#"Transform file (7)"(#"Sample file (7)"))
    ),
    #"Transform columns" = Table.TransformColumnTypes(
        #"Expanded table column",
        {
            {"ID", type text},
            {"Description", type text},
            {"Qty", type text},
            {"Value", type text},
            {"Date", type text},
            {"City1", type text},
            {"City2", type text}
        },
        MissingField.Ignore
    ),
    #"Replace errors" = Table.ReplaceErrorValues(
        #"Transform columns", List.Transform(Table.ColumnNames(#"Transform columns"), each {_, null})
    )
in
    #"Replace errors"

Pat

Microsoft Employee

I tried above Code

 

it give an following error

 

hsampath81_0-1670947097467.png

 Harsha

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors