Issues on fetching stock data at specific time in google sheet - google-sheets

I want to fetch stock value at specific time(for example 10:00:00) in google sheet.
I'm using the following function but it's not working for me.
=GOOGLEFINANCE(A4,"price",time(10,00,00))
It shows an error as The query has returned no data
Kindly suggest the way to get it using googlefinance or by any other way.
Thanks.

Related

Can text be scraped from Grammarly to google spreadsheet using IMPORTXML function?

I am trying to get texts from the Grammarly application imported into a Google spreadsheet using the IMPORTXML function. To do so, I follow the required syntax IMPORTXML(URL, xpath_query), but it keeps showing an error that the "imported content is empty".
However, the same steps work fine to import data from other websites, and I am confused what might be the matter with Grammarly. Is it because it does allow data scraping at all, maybe?
Thanks for your help. 1 2 3
not possible because this is behind the login gate. google sheets cant read such data

How to extract data of previous week based on drop down from the Yahoo Fantasy Football

Hy, I am using Yahoo Fantasy Football and I have design Google Sheet to get the score data which is the working fine. The link to the sheet is as under.
Google Sheet Link
I have changed the permission to Editor. I have made a drop-down which holds the information of Week numbers. Basically, my idea is that by choosing the week number I want to populate the data from yahoo fantasy football. For importing data, i am using this command.
=importhtml("https://football.fantasysports.yahoo.com/f1/683375","table",1)
and this command is working well.
I tried it by using the same command but it does not works for the week numbers. The source of the page is as under.
so according to the given picture, here is the week number, I want to implement the same in the google sheet by using the dropdown. I have implemented the drop down but it does not work. Is there a way to interlink both using scripts or command so from google sheet when I chose week from the drop-down the concerning data should be populated? please take a look at the Google Sheet given above. I am also getting this error, while it was working fine before, how can it be resolved also.
Thanks
IMPORTHTML cannot retrieve elements dynamically inserted by a script. In your case the content on Week matchups is inserted dynamically and therefore will not be retrieved (it will return empty). Moreover, IMPORTHTML olny gets data from tables or lists and if you inspect what it seemed to be a table in Week Matchup is just actually a series of divs. If the content would not be inserted dynamically, to get the data from these divs you would need to use IMPORTXML.
If you still want to retrieve this information I am afraid that you will need to look for other web scraping techniques.

Google Sheets IMPORTXML XPath - Imported Content is empty [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I'm attempting to parse the 'PEG Ratio' value of a stock from Yahoo Finance into a Google Sheet, but seeing an error.
URL used: https://finance.yahoo.com/quote/ABBV/key-statistics?p=ABBV
Cell Expression used: =IMPORTXML("http://finance.yahoo.com/quote/ABBV/key-statistics?p=ABBV", "//td[#data-reactid='132']")
Error: '#N/A' value (Error: Imported Content is empty)
Value expected is 1.28 (at the time of posting this query) - from Yahoo Finance > Statistics tab > PEG Ratio table (td has a, attribute data-reactid='132' that I have attempted to filter in the query)
Can anyone help please? Here is a link to the sheet: Google Sheet
Issue
IMPORTXML can only read the HTML source of a website. Therefore, those elements and components of a website added dynamically will not be able to be retrieved by the IMPORTXML and thus IMPORTXML will interpret the tag to be with empty content.
Possible workaround
Sometimes, in the Javascript files of the website, you can find out the URL of the source of data being inserted dynamically but that is a tedious task to achieve.
Other option to get the desired value is to use other web scraping techniques.
I hope this has helped you. Let me know if you need anything else or if you did not understood something. :)
This is probably not what you want, but I was searching around, and found a Google Sheets Add-On that does manage to pull the "1.28" value from that page. It is free for doing a very limited number of queries per month. If interested, search for IMPORTFROMWEB in the GSuite Marketplace.
I only plugged in your URL and the same XPath that you used, so I was very surprised when the data showed up. No idea how it works.
I apologise if mentioning an Add-On is not appropriate on SO. But knowing that an add-on can get that data off the web page may encourage some other ideas on how to do it natively with Sheets.

How to Get A Company Financials in to Google Sheets

I am trying to get a specific value from a public company's balance sheet into Google Spreadsheet to better analyze the company financials. I want to add the ticker in one of the cells and via a formula, I will get the Total Current Assets for example.
Is there a way to it?
The main issue is that the data is populated after the page is being rendered, so even if I use the IMPORTHTML and set the right XPath I am getting Imported content is empty. It because the value is since it is being fetched on the on a later script.
I found this service which provides the company's financials in a JSON and CSV formats, but I dont know how to parse it on the googlesheet.
Should be something that someone already solved.
Thanks

importXML Parse Error [duplicate]

This question already has answers here:
Scraping data to Google Sheets from a website that uses JavaScript
(2 answers)
Closed last month.
I need to parse balance sheet data for a given set of stocks on otcmarkets.com. I'm trying to use the importXML function in Google Spreadsheet, but it is not returning any data for me. The xPath query did not return any data. Here is the function I'm using:
=importxml("http://www.otcmarkets.com/stock/AAEH/financials","//*[#id=’totalCurrentLiabilities’]")
Let me know what I'm doing wrong and if there is a better way to parse specific balance sheet data.
The page contents are loaded using JavaScript, which is not executed in Google Spreadsheets. You cannot parse this page using =importxml(...).
What to do now?
Ask the providers if they offer an API. Most probably they don't want to be scraped anyway.
Analyze the page logic and find the JavaScript call which loads the data, and fetch it yourself. Most probably it is in JSON format, which is not easy to parse in Google Spreadsheets without external libraries.
Use some environment to query the data which will execute the JavaScript calls, for example Selenium. Will result in much more programming than using Google Spreadsheets.
Try using the importdata function:
=IMPORTDATA("http://www.otcmarkets.com/otciq/ajax/EdgarFinancialsController.json?ticker=AAEH&mode=annual")

Resources