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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
mridulmathur
New Member

DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong

hi all, I am trying to import data from MCX site in excel

but getting below error:

DataSource.Error: The downloaded data is HTML, which isn't the expected type. The URL may be wrong or you might not have provided the right credentials to the server.

 

below is the code, its a post call with Json Payload. i have tried both Json.fromValue and text.tobinary but got similar result:

 

let
Source = Json.Document(Web.Contents("https://www.mcxindia.com/market-data/option-chain", [Content=Json.FromValue([Commodity="CRUDEOIL", Expiry="17OCT2022"]),
Headers=[Cookie="_ga=GA1.2.1341481004.1662073518; device-referrer=; device-source=https://www.mcxindia.com/; ASP.NET_SessionId=hs0aoriiadw3u41bke0pyz4f; _gid=GA1.2.1265856523.1663745533",
#"Content-Type" = "application/x-www-form-urlencoded", #"Accept" = "application/json"]]),TextEncoding.Unicode)
in
Source

1 REPLY 1
Anonymous
Not applicable

Hi  @mridulmathur , 

I found some similar post, hope they could help you.

Solved: The downloaded data is HTML, which isn't the expec... - Microsoft Power BI Community

DataSource.Error: The downloaded data is HTML, whi... - Microsoft Power BI Community

 

And try .. otherwise is the error-handler in Power Query. Also check out this post: Handling Data Source Errors In Power Query – Chris Webb's BI Blog

 

Best Regards,

Stephen Tao

 

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

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.