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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

What's wrong with the code

let
Source = SharePoint.Files(Web.Contents("https://[site].sharepoint.com/sites/ITLeadership"), null, true),
#"Filtered Rows" = Table.SelectRows(Source,each ([Folder Path] = "https://[site].sharepoint.com/sites/ProjectITLeadership/_layouts")),
#"Promoted Headers" = Table.PromoteHeaders(Source, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Active Projects - 48", type text}, {"Computer Users", Int64.Type}, {"Project IT Staff", Int64.Type}, {"""AS Sold"" Project Cost", Int64.Type}, {"Project IT Budgets Current IT Spend of all Projects", Int64.Type}, {"Current IT Spend of all Projects", Int64.Type}, {"Column7", type text}, {"Column8", type any}, {"Column9", type any}, {"Column10", type text}, {"Column11", type any}}),
#"Kept First Rows" = Table.FirstN(#"Changed Type", each [#"Active Projects - 48"] <> null),
#"Removed Other Columns" = Table.SelectColumns(#"Kept First Rows",{"Active Projects - 48", "Computer Users", "Project IT Staff", """AS Sold"" Project Cost", "Project IT Budgets Current IT Spend of all Projects", "Current IT Spend of all Projects"})
in
#"Removed Other Columns"

 

 

 

Is the file path wrong? I have an excel sheet uploaded into sharepoint and from sharepoint I open the excel sheet but usually when i inport the data to power bi i have to look for the specific excel sheet.

 

 

Expression.Error: 3 arguments were passed to function which expects between 1 and 2.
Details:
Pattern=
Arguments=List

 

 

i got this errror

1 REPLY 1
ImkeF
Community Champion
Community Champion

Yes, there is a problem with the Source-step. Use this instead:

 

Source = SharePoint.Files(Web.Contents("https://[site].sharepoint.com/sites/ITLeadership"))

 

or: Source = SharePoint.Files(Web.Contents("https://[site].sharepoint.com/sites/ITLeadership"), 15)

 

see: https://docs.microsoft.com/en-us/powerquery-m/sharepoint-files

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.