Unable to fetch data through IMPORTXML from NSE website in Google sheets - google-sheets

I am trying to fetch current/ latest price from a dynamic content from National Stock Exchange (India) website in a cell in google sheets. The formula is:
=importxml("https://www.nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuoteFO.jsp?underlying=NIFTY&instrument=OPTIDX&strike=11400.00&type=CE&expiry=27SEP2018"),"//ul[#class='stock']/li[#class='active']/span[#id='lastPrice']")
Not getting the correct value.

Instead use =GOOGLEFINANCE("NSE:INFY", "all", DATE(2021,5,21), DATE(2021,6,24), "DAILY")

Related

How to extract current price in Google Sheets using importxml from

I can't extract the price on this page with the importxml function: https://www.castorama.pl/regal-metalowy-gammel-180-x-90-x-40-cm-5-polek-175-kg-ocynk-id-69652.html
I tried to do it like below but it doesn't work.
=importxml(A1;"/html/body/div/div[2]/div/section/div[2]/div[2]/section/div[1]/section/span[2]/text()")
there is no price when you disable JS so your formula does not work because google sheets importxml cant read JS elements:

google sheets,yahoo finance,price and dividend data

I created my own international portfolio tracker / dividend tracker through google sheets & yahoo finance.
The problem with international stocks is that you often cannot simply use the integrated data from google finance. KO (coca cola) is easy, CCC3.DE (also coca cola) cannot be found on google finance. suddenly some formulas stop working for some of the tickers.
For Example AD.AS does work but ccc3.de does not work.
For price is use; A1 = "CCC3.DE" or "AD.AS"
=IFNA(VALUE(IMPORTXML("https://finance.yahoo.com/quote/" &A1, "//*[#class=""D(ib) Mend(20px)""]/span[1]")))
For dividend amount I use;
=split(IMPORTXML(concatenate("http://finance.yahoo.com/quote/",index(split((E9&F9&G9),":"),0,2)),$F$22),"()"))/K9)))
It seems that Yahoo changed some things in their website and it resulted to the import formula not to work anymore for some of the webpage in Yahoo Finance as well as for some tickers. This is the result of the IMPORTXML command for the CCC3.DE ticker.
For now, I suggest finding another website/data source that will give you the same information that you need for those unavailable/unscrapeable tickers. Another option would be to wait for yahoo to fix this issue.

Google sheet transpose yahoo finance data and ignore multiple rows

gurus,
I am trying to get yahoo finance quote page info into google sheet. What bothers me is the earning date, which could be a range:
The following code works, but the earning date will return into 4 lines with the React notes
=transpose(IMPORTXML(CONCATENATE("https://finance.yahoo.com/quote/",B7,"?p=",B7),"//tr//td[last()]"))
Is there anyway I can consolidate the data from O8-O12 into O7? Or just simply ignore the O8-O12 data in this example. Thank you!
Use a query formula as well and limit results to 1:
=QUERY(transpose(IMPORTXML(CONCATENATE("https://finance.yahoo.com/quote/",B7,"?p=",B7),"//tr//td[last()]")),"LIMIT 1")

How to get single sheet from multisheet workbook in Google Sheets

So I have shared a google workbook and I have created a key and so I can retrieve the structure of the workbook with the following link
Google Sheets - Copy of Guardian University Guide 2018
and in the results I can see the sheets in an array, so first element in an array has sheetId of 1544561606 so I presume somehow I can form a second url with this sheetId as well as original spreadsheet id and get the contents of the this sheet but the documentation is sparse IMHO. THen I can do the same for all the other sheets. I just can't find the correct url format. Please help.
This is version 4.0 of Google Sheets API.
From your endpoint, the sheet name of the sheet ID 1544561606 is "Institutional". You can retrieve the sheet data using this sheet name. The endpoint is as follows.
https://sheets.googleapis.com/v4/spreadsheets/1nDSd38lIQj_aTWDRPJ-aPybR0NwFdQ8GLSDJM0-QaR4/values/Institutional?key=AIzaSyBUHA34c7FmNLut1V7Pe3lIJTk3pX39J6E
Reference :
spreadsheets.values.get
If I misunderstand your question, I'm sorry.

Retrieve stock "change in percentage" in google spreadsheet with ImportXML()

I would like to retrieve stock data on Google Spreadsheet through the ImportXML() function.
Suppose I want to retrieve stock data of SHA:000001
To retrieve price, the formula to use is;
=ImportXML("https://www.google.com/finance?q=SHA:000001", "//span[#class='pr']")
What is the formula to use for retrieving "price change in percentage" for the day?
This worked for me:
=ImportXML("https://www.google.com/finance?q=SHA:000001", "//div[#class='id-price-change nwp']/span/span[2]")

Resources