Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
Solved! Go to Solution.
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.
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?
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
68 | |
60 | |
42 | |
28 | |
22 |