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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
rkoehl
New Member

URL is accessible via web browser; however, Expression.Error: Access to the resource is forbidden

I have been having an issue for the past week with loading data from a public website that has previous been working for me.  Up until recently, I have been able to load this data with out any issues.  Suddenly, I am getting the following error message:

 

Expression.Error: Access to the resource is forbidden.

 

If I navigate to the URL via my web browser, I am able to download the file, but for some reason I am not able to access the URL via my PowerQuery query.

https://www.spglobal.com/spdji/en/idsexport/file.xls?hostIdentifier=48190c8c-42c4-46af-8d1a-0cd5db89...

 

Here's the PowerQuery query in question:

let
    WebContents = Web.Contents( "https://www.spglobal.com",
        [
            RelativePath = "spdji/en/idsexport/file.xls",
            Query = [
                hostIdentifier = "48190c8c-42c4-46af-8d1a-0cd5db894797",
                redesignExport = "true",
                languageId = "1",
                selectedModule = "PerformanceGraphView",
                selectedSubModule = "Graph",
                yearFlag = "tenYearFlag",
                indexId = "30000005"
            ]
        ] ),
    XlsWorkbook = Excel.Workbook(WebContents, null, true)
in
    XlsWorkbook

 

I've tried everything I could think of in terms of permissions, but to no avail.

 

I would suspect something has changed on the site I consuming the data from; however, I'm not sure how to work around it.  Any thoughts on what could have changed and how I could work around it?

 

Thanks in advance for you help!

 

Kind Regards,

Robert

1 ACCEPTED SOLUTION
v-junyant-msft
Community Support
Community Support

Hi @rkoehl ,

Given that you can access the URL directly through a web browser but not through Power Query, it's possible that the website now requires additional authentication or headers that your Power Query request does not currently include. Here are a few steps you can take to troubleshoot and potentially resolve this issue:

1. Since you mentioned that this issue started occurring recently, it's possible that the website has implemented changes requiring additional authentication or headers. If possible, check the website's documentation or contact their support to see if there have been any recent changes to their access requirements.
2. Power Query's Web.Contents function allows for specifying additional options such as headers. If the web source now requires a specific header for access, you may need to include this in your query. For example:

let
    WebContents = Web.Contents("https://www.spglobal.com", [
        RelativePath = "spdji/en/idsexport/file.xls",
        Query = [
            hostIdentifier = "48190c8c-42c4-46af-8d1a-0cd5db894797",
            redesignExport = "true",
            languageId = "1",
            selectedModule = "PerformanceGraphView",
            selectedSubModule = "Graph",
            yearFlag = "tenYearFlag",
            indexId = "30000005"
        ],
        Headers = [Authorization="Bearer <Your_Token_Here>"]
    ]),
    XlsWorkbook = Excel.Workbook(WebContents, null, true)
in
    XlsWorkbook

3. Ensure that your Power BI environment and the account you're using have the necessary permissions to access the web source. This might involve checking if any organizational policies or conditional access settings have changed that could impact your access.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-junyant-msft
Community Support
Community Support

Hi @rkoehl ,

Given that you can access the URL directly through a web browser but not through Power Query, it's possible that the website now requires additional authentication or headers that your Power Query request does not currently include. Here are a few steps you can take to troubleshoot and potentially resolve this issue:

1. Since you mentioned that this issue started occurring recently, it's possible that the website has implemented changes requiring additional authentication or headers. If possible, check the website's documentation or contact their support to see if there have been any recent changes to their access requirements.
2. Power Query's Web.Contents function allows for specifying additional options such as headers. If the web source now requires a specific header for access, you may need to include this in your query. For example:

let
    WebContents = Web.Contents("https://www.spglobal.com", [
        RelativePath = "spdji/en/idsexport/file.xls",
        Query = [
            hostIdentifier = "48190c8c-42c4-46af-8d1a-0cd5db894797",
            redesignExport = "true",
            languageId = "1",
            selectedModule = "PerformanceGraphView",
            selectedSubModule = "Graph",
            yearFlag = "tenYearFlag",
            indexId = "30000005"
        ],
        Headers = [Authorization="Bearer <Your_Token_Here>"]
    ]),
    XlsWorkbook = Excel.Workbook(WebContents, null, true)
in
    XlsWorkbook

3. Ensure that your Power BI environment and the account you're using have the necessary permissions to access the web source. This might involve checking if any organizational policies or conditional access settings have changed that could impact your access.

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the help, Dino.  I will see if this gets me back up and running.  I'll keep you posted.

Hello, @rkoehl . I'm having a similar issue with spglobal. Have you managed to resolve the issue?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors