Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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
 
					
				
		
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.
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
