Reputation: 533
I am trying to scrape some data from a website, but I only need a specific value from the website to be shown in Google Sheets.
Now what I am trying is to use the IMPORTXML
function.
The website that I am trying to get data is https://dps.psx.com.pk/company/TRG I need the price specifically i.e. Rs. 172 (or whatever it may be at a certain time) - I need only the price but if currency is showing up e.g. Rs.172 that would be fine as well
So far I am trying this and it only returns #N/A
=IMPORTXML(A1,"//span[@class='quote__close']")
Where A1 is the cell with the link in it.
From the web page I need the value 172.72 in the sheet and when I inspect element it shows what is displayed in the second screenshot
Upvotes: 1
Views: 1125
Reputation: 201713
When I saw the image of the HTML, it seems that the value you want is put in the tag of div
. So how about the following modification?
=IMPORTXML(A1,"//div[@class='quote__close']")
//div[@class='quote__close']
.Upvotes: 3