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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.