Following on form a successfully answered post here: Is it possible to parameterise a url such that url title display as href - PQ
I am trying to do the same with a different area of the same website (provides two different types of useful links: Factsheet Url and Substance information Page) create a function that can Download the Xlxs data from the website for searched chemicals through power query.
So far however the excel file downloaded doesnt appear to contain the right data and im not sure what im doing wrong.
Steps takemn:
- Search on https://echa.europa.eu/information-on-chemicals/registered-substances For Substance name: Acetone and CAS number:67-64-1
- Click on export button once searched for and then with developer tools open clicked on the XLS button to identify from network the POST reuqest and parameters which can be seen in the M Code:
Request URL:
https://echa.europa.eu/information-on-chemicals/registered-substances?p_p_id=dissregisteredsubstances_WAR_dissregsubsportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=exportResults&p_p_cacheability=cacheLevelPage&_dissregisteredsubstances_WAR_dissregsubsportlet_sessionCriteriaId=dissRegSubsSessionParam101401655391028695
Form Data:
_dissregisteredsubstances_WAR_dissregsubsportlet_formDate=1655391028770&disreg_substanceMasterSearchPerformed=false&substanceId=&disreg_substanceDetailsSearchPerformed=false&businessIdentifier=&disreg_ec-number=&disreg_cas-number=67-64-1&disreg_name=Acetone&disreg_registrationNumber=&disreg_registrant=&disreg_registrantAddress=&disreg_totalTonnageBandMin=null&disreg_totalTonnageBandMax=1000000000&disreg_lastUpdateMinDate=&disreg_lastUpdateMaxDate=&disreg_registrantLastUpdateYear=null&disreg_country=&disreg_pbtAssessmentOutcome=null&disreg_csaPerformed=&disreg_registrationType=&disreg_registrationStatus=&disreg_submissionType=&disreg_firstPublishedMinDate=&disreg_firstPublishedMaxDate=&disreg_tonnageBandType=ALL&disreg_usesOperator=AND&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType1&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType2&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType3&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType4&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType5&disreg_highlightedname=&disreg_highlightedecnumber=&disreg_highlightedcasnumber=&disreg_orderByCol=relevance&disreg_orderByType=asc&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_exportType=xls&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_exportTab=ALL+SUBSTANCES
When throwing this into M Code:
let
Source = Excel.Workbook(Web.Contents("https://echa.europa.eu/information-on-chemicals/registered-substances?"&
//URL Request
"p_p_id=dissregisteredsubstances_WAR_dissregsubsportlet&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=exportResults&p_p_cacheability=cacheLevelPage&_dissregisteredsubstances_WAR_dissregsubsportlet_sessionCriteriaId=dissRegSubsSessionParam101401655391028695"&
//Form Data
"_dissregisteredsubstances_WAR_dissregsubsportlet_formDate=1655391028770&disreg_substanceMasterSearchPerformed=false&substanceId=&disreg_substanceDetailsSearchPerformed=false&businessIdentifier=&disreg_ec-number=&disreg_cas-number=67-64-1&disreg_name=Acetone&disreg_registrationNumber=&disreg_registrant=&disreg_registrantAddress=&disreg_totalTonnageBandMin=null&disreg_totalTonnageBandMax=1000000000&disreg_lastUpdateMinDate=&disreg_lastUpdateMaxDate=&disreg_registrantLastUpdateYear=null&disreg_country=&disreg_pbtAssessmentOutcome=null&disreg_csaPerformed=&disreg_registrationType=&disreg_registrationStatus=&disreg_submissionType=&disreg_firstPublishedMinDate=&disreg_firstPublishedMaxDate=&disreg_tonnageBandType=ALL&disreg_usesOperator=AND&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType1&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType2&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType3&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType4&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_useCategories%5B%5D=useType5&disreg_highlightedname=&disreg_highlightedecnumber=&disreg_highlightedcasnumber=&disreg_orderByCol=relevance&disreg_orderByType=asc&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_exportType=xls&_dissregisteredsubstances_WAR_dissregsubsportlet_disreg_exportTab=ALL+SUBSTANCES"
))[Data]{0}
in
Source
Unfortunately this just returns:
Which when compared to the opening the actual Xls file:
So im confident this can be done but clearly something isn't working.


