1

I build a Power BI report using a Sharepoint Site with an Excel, and everything works fine but if I change the data source for a different Sharepoint Site with the same Excel it put me this error: "The OAuth authentication method isn't supported for this data source"

Did you know how can i fix it?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437

1 Answers1

0

I hope you have solved your issue. For future reference I will share my solution to the error message that you (and I) have encountered.

I was using the web connection with the direct url to the Excel file on Sharepoint, like explained in this tutorial. However, after uploading the Power BI report to the service I was not able to authenticate against the Sharepoint resource.

After changing the direct web link to the Excel file to the Sharepoint Folder connector I was able to use OAuth2 authentication method. Below is the (redacted) M code:

let
    Source = SharePoint.Files("https://organizationname.sharepoint.com/sites/teamsite/", [ApiVersion = 15]),
    ExcelFile = Source{[Name="SourceExcelName.xlsx",#"Folder Path"="https://organizationname.sharepoint.com/sites/teamsite/Shared Documents/path01/"]}[Content],
    ImportExcelFile = Excel.Workbook(ExcelFile),
    Sheet = ImportExcelFile{[Item="Targets",Kind="Sheet"]}[Data],
    PromoteHeaders = Table.PromoteHeaders(Sheet, [PromoteAllScalars=true]),
    ChangeDataType = Table.TransformColumnTypes(PromoteHeaders,{{"Source name", type text}, {"Source file name", type text}, {"Maximum", Int64.Type}})
in
    ChangeDataType

Here is a link to a tutorial: https://powerbi.tips/2016/09/loading-excel-files-from-sharepoint/

Hope this help.

Koen
  • 475
  • 4
  • 17