Search code examples
javascriptgoogle-sheetsweb-scrapinggoogle-sheets-formula

ImportXML - Javascript? Imported content is empty


I'm trying to Import a field that helps indicate if a restaurant is currently accepting Online Orders or not.

=INDEX(IMPORTXML("https://www.doordash.com/store/yolk-test-kitchen-chicago-395338/en-US/?pickup=true","//div[@class='sc-cmIlrE bzKTjf']"),1)

I'm not sure why, but I think the data I'm looking for is possibly hidden due to javascript? Is there any way for me to retrieve this still with google sheets?

enter image description here


Solution

  • IMPORTXML Imports data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds.

    The data you are trying to import is loaded by script, therefore is not retrievable by IMPORTXML

    I have tried to use the fetch(url) method from apps script and the page did not return the information you require.

    If you go to Chrome Dev Tools and disable javascript you will see after reloading the page that no information is shown, that means that the entire page is loaded via script. You can do it by following Disable JavaScript With Chrome DevTools