IMPORTXML works fine if the data in the website is rendered in XML, HTML, CSV, TSV, and RSS and ATOM XML feeds. However some webpages uses Javascript to build it so the data can't be imported using this function.
Imported content is empty
or The imported XML content can not be parsed
will show as results when the XPath is not a valid HTML element so Google Sheets can’t recognize the content from it.
To check if the website you want to import data is valid HTML or it is build using script, you can disable Javascript.
- Open the website that you want to check.
- Open Chrome DevTools.
- Depending on your operating system, press one of the following:
-
On Window or Linux, Control+Shift+P
-
On MacOS, Command+Shift+P
It will open the command menu.
4. Search for Javascript and click Disable Javascript
.
If you see < > with a red x icon in the address bar that means you have successfully disabled JavaScript.
- Reload the page. If the website load correctly, then you can import the data showing else there's no data can't be imported using the Google Sheets functions.
I also tried to fetch data from the website using UrlFetchApp.fetch() in Google Appscript however the website is build in Javascript that's why we can't fetch the data on it.
Reference: