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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Kudoed Authors