0
votes

I am trying to use the ImportXML formula in Google Sheet to pull some Analyst rating data from Stock Target Advisor. Here is the formula that I am using for pulling Avg. Target Price:

=IMPORTXML("https://www.stocktargetadvisor.com/stock/Asia/NSE/PETRONET#analyst-rating-tab","/html/body/div[2]/div[3]/div/div/div/div/div/div[1]/div/div/div/div[1]/div[2]/div/div[6]/span/span")

I am also trying to use similar other data points from this website by using the Copy XPath in Inspect Element as given below, but getting the same error in each instance.

Xpaths

Analyst /html/body/div[2]/div[5]/div/div[2]/div/div[2]/div[1]/div/div[5]/div[1]/div[2]/div/div/div/div/div[2]/table/tbody/tr[1]/td[3]/a

Rating
/html/body/div[2]/div[3]/div/div/div/div/div/div[1]/div/div/div/div[2]/div/div/div[1]/p

Target Price
/html/body/div[2]/div[5]/div/div[2]/div/div[2]/div[1]/div/div[5]/div[1]/div[2]/div/div/div/div/div[2]/table/tbody/tr[1]/td[5]

Target Date /html/body/div[2]/div[5]/div/div[2]/div/div[2]/div[1]/div/div[5]/div[1]/div[2]/div/div/div/div/div[2]/table/tbody/tr[1]/td[6]

Avg. Target Price
/html/body/div[2]/div[3]/div/div/div/div/div/div[1]/div/div/div/div[1]/div[2]/div/div[6]/span/span

Avg. Analyst Rating /html/body/div[2]/div[3]/div/div/div/div/div/div[1]/div/div/div/div[2]/div/div/div[1]/p

Fundamental Analysis
/html/body/div[2]/div[3]/div/div/div/div/div/div[1]/div/div/div/div[2]/div/div/div[2]/p

Some help would be much appreciated. Thanks.

1

1 Answers

0
votes

you can safely scrape only this:

enter image description here

rest is JS controlled and import functions of google sheets are not capable of reading such elements