I tried following formula for getting pcr data...
=importxml("https://niftyinvest.com/put-call-ratio/MARUTI?expiry=30JUN2022","//span[@class='white-text red darken-1']"
For different stocks the values are in 3 different colours red/blue/green depending on their values predefined. How to get the common formula so that it can retrieve data in whatever colour plz ????
Other Data Links...
for Intraday Pcr
:
=INDEX(IMPORTXML(A2,
"//span[@class='white-text red darken-1'] |
//span[@class='white-text light-blue lighten-1'] |
//span[@class='white-text green darken-1']"), 2)
CodePudding user response:
Try to use this generic xpath //span[@class[contains(.,'white-text ')]]
=importxml("https://niftyinvest.com/put-call-ratio/MARUTI?expiry=30JUN2022","//span[@class[contains(.,'white-text ')]]")