0

I'm going to get the updated GDP info by using importXML from IMF webpage. I type in the following in the spreadsheet, but it return "N/A" Is there anything wrong with my input?

=importxml("http://www.imf.org/external/datamapper/NGDP_RPCH@WEO/OEMDC/ADVEC/WEOWORLD","//*[@id='dm-main']/div[1]/radio-group/div[3]/imf-ranking/radio-group/div[2]/div[2]")
2

The bot that fetches content for importxml only gets the HTML source of the page, not any dynamic elements inserted in it with JavaScript. You can see what it sees by opening the page and choosing view-source (typically available with right-click). This is the relevant HTML element:

<imf-ranking dataset={parent.state.dataset} indicators={parent.state.indicators} year={parent.year}></imf-ranking>

There is no data here. The attributes like dataset={parent.state.dataset} indicate that the data will be inserted in this element with a script. importxml cannot access it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.