Google Sheet importxml for Price [duplicate] - google-sheets

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I'm trying to get prices on this site, but it's always NA.
https://id.xiapibuy.com/product/51925611/16618169044
Please help me check , thanks!
=IMPORTXML(A1,"/html/body/div[1]/div/div[2]/div[1]/div/div[2]/div/div[1]/div[3]/div/div[3]/div/div/div/div/div/div/font/font")
enter image description here

if you disable JavaScript on the given URL you can see the page is empty
google sheets is not able to work with / import JS content

Related

IMPORTXML returns blank returns #NA (website uses js DataLayer [duplicate]

This question already has answers here:
Why importxml and importhtml not working here? [duplicate]
(1 answer)
Google Sheets ImportXML from Etsy- Import data from multiple pages with dynamic navigation
(1 answer)
Closed 5 months ago.
I am trying to get data from a website. After trying different approaches I figured the website is using js to render itself so for that reason I am getting no results.
I've used =IMPORTXML("https://website.com/","html") and I got this as a proof:
"function
gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag(""js"",new
Date),gtag(""config"",""UA-235635761-1"")function
gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag(""js"",new
Date),gtag(""config"",""G-Y8DS8XZ3TZ"")website"
So Google Sheets is getting no results because there is no html or any tags. When I open the page on the browser it loads normally and I can see the tag I am looking for.
Is there any way to overcome this? I was thinking maybe saving the html first in a gdrive folder then using importxml. Any tips?

ImportXML extract paginated table into Google Sheets [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I would like to scrape this table url is:
https://www.londonstockexchange.com/indices/ftse-aim-all-share/constituents/table?page=1
As you can see its currently 39 pages but this can change so it's dynamic. Can someone please provide guidance on how to import it into google sheets. I have come up with the following so far:
=IMPORTXML(https://www.londonstockexchange.com/indices/ftse-aim-all-share/constituents/table?page=1", "table",1)
But it doesn't seem to work
The website you are trying to scrape is loading the table dynamically. IMPORTXML is used only for static content.
Your best bet would be to write your own script to parse it, or to find a paid service.

How to get the correct XPath for ImportXML [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I tried for the past 2 hours using an xPath scraper, inspecting, googling and still can't figure this out for the life of me.
I'm trying to scrape the interest rates on this table but it's not pulling through ->
Website
https://www.fhlbboston.com/fhlbank-boston/rates#/long-term
Formula (incorrect)
importxml("https://www.fhlbboston.com/fhlbank-boston/rates#/long-term","//table",1)
import formulae of google sheets does not support the scrapping of JavaScript elements. you can always check this by disabling JS for a given site and usually only what is left can be imported. in your case:
the workaround would be to find alternative URL that hosts your desired dataset

importhtml not working with URL in Google Sheets [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
In a google sheets I try to read and import a table with this command:
=importhtml("https://www.hermesairports.com/flight-info/pafos/arrivals-and-departures"; "table"; 2)
result is:
#N/A
How i read the table with departures flights of the day in website https://www.hermesairports.com/flight-info/pafos/arrivals-and-departures ?
Your query is correct, but =IMPORTHTML can only import plain text, not Javascript contents
You can easily verify that the table you are interested is Javascript content by
Going on the websote https://www.hermesairports.com/flight-info/pafos/arrivals-and-departures
Click on the "lock" left from the address bar to view site permissions
The steps are slightly different depending on your browser, for Google Chrome:
Go on Permissions -> Javascript
Change the dropdown vlaue to Block
erfresh the Website
All content you cannot view when blocking Javascript is the content that you cannot import with =IMPORTHTML.

Google Sheets yahoo finance importXML text not td data [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
On SO I often see people inquiring about how to import data from the tables on yahoo finance. I'm trying to import the business description under the profile section from yahoo finance. It seems this would require the importxml function but I'm struggling. This is my function:
=IMPORTXML("http://finance.yahoo.com/quote/AAPL/profile", "//div[#data-reactid='139']")
I think my issue is related to "div" but not sure. Might anyone be able to provide guidance? Thanks!
Sample formula:
=IMPORTXML(A1,"//h2[#data-reactid='139']/../p")
In this case, the URL of http://finance.yahoo.com/quote/AAPL/profile is put in "A1".
I used //h2[#data-reactid='139']/../p as the xpath.
Result:

Resources