importXML Parse Error

后端 未结 2 687
日久生厌
日久生厌 2020-12-10 21:46

I need to parse balance sheet data for a given set of stocks on otcmarkets.com. I\'m trying to use the importXML function in Google Spreadsheet, but it is not returning any

相关标签:
2条回答
  • 2020-12-10 22:48

    The page contents are loaded using JavaScript, which is not executed in Google Spreadsheets. You cannot parse this page using =importxml(...).

    What to do now?

    • Ask the providers if they offer an API. Most probably they don't want to be scraped anyway.
    • Analyze the page logic and find the JavaScript call which loads the data, and fetch it yourself. Most probably it is in JSON format, which is not easy to parse in Google Spreadsheets without external libraries.
    • Use some environment to query the data which will execute the JavaScript calls, for example Selenium. Will result in much more programming than using Google Spreadsheets.
    0 讨论(0)
  • 2020-12-10 22:48

    Try using the importdata function:

    =IMPORTDATA("http://www.otcmarkets.com/otciq/ajax/EdgarFinancialsController.json?ticker=AAEH&mode=annual")
    
    0 讨论(0)
提交回复
热议问题