问题
=Importhtml("https://app.neilpatel.com/en/ubersuggest/keyword_ideas?keyword=Food%20Chart&locId=2840&lang=en", "table", 3)
=ImportXML("https://app.neilpatel.com/en/ubersuggest/keyword_ideas?keyword=Food%20Chart&locId=2840&lang=en","//div[@class='css-19jz7zx']")
I use the above formula to get keywords in my google sheet. but I only get #N/A
(Error Imported content is empty)
I'm unable to understand what is wrong with my formula, why I'm unable to get data. please help me with this.
回答1:
I think that the reason of your issue is due to You need to enable JavaScript to run this app.
which are shown when the value is retrieved from the URL with IMPORTXML and Google Apps Script.
For example, when the site is retrieved by the xpath of //body
, only the value of You need to enable JavaScript to run this app.
is returned.
Unfortunately, the built-in functions of Spreadsheet cannot be run the Javascript. By this, such error occurs. In this case, even when Google Apps Script was used, the values cannot be directly retrieved from the URL.
回答2:
it is not about formula but website. you will need to find a different one because Google Sheets is not able to scrape JavaScript content. you can check this simply by disabling JS for a given site and you will see a blank page like:
来源:https://stackoverflow.com/questions/58842048/why-importxml-and-importhtml-not-working-here