7

Follow-up of

Recently I have found that many "bad" questions about importing Yahoo Finance data into Google Sheets by using IMPORTHTML / IMPORTXML built-in functions have very similar answers.

  1. It's not possible by using Google Sheets built-in functions
  2. Include a suggestion of using Google Apps Script to parse JSON included in the source file

Usually the scripts are tailored to the specific OP requirements. Very rarely do they make reference to another post so in the best cases we have a lot of answers repeating again and again the same explanations and in the worst cases there isn't any hint or guidance about how to adapt the script to similar cases.

Considering the above, I as a gold-tag badge holder, am wondering which could be the best question to be used as the duplicate target for questions repeating the same pattern (in short, the OP didn't followed the Ask Question Wizard):

  1. The OP used the web browser developers tools wrongly to get the index of the table, list or xPath of the text to be imported.
    • Used the Elements tab to get the xPath from the rendered DOM
    • Used the web browser console to execute some JavaScript code to get data from the rendered DOM
    • The above is wrong because Google Sheets built-in functions can see only the source code of the main file, it can't execute JavaScript / do additional network calls to load data.
  2. There is one or more formulas using IMPORTHTML or IMPORTXML
  3. Sometimes the OP mentions the error message displayed in the spreadsheet.

Here is a search to look to related questions:

[google-sheets] [yahoo-finance] duplicate:0 answers:1 returns 42 results

Other searches


Looking at several answers that suggested to use Google Apps Script instead of Google Sheets built-in functions most of them are not working as of January 4th 2023. At first I thought that it might caused because a change on the elements id, class names or other DOM changes that affecting the xPath.

There are reports that Yahoo! Finance started to encrypt the JSON included in the https://finance.yahoo.com. I found a mention of this situation here in Tainake's answer to How to pull Yahoo Finance Historical Price Data from its Object with Google Apps Script?. This question is slightly different as it's not about using Google Sheets built-in functions but it's a follow-up question of a question posted one year ago about using Google Apps Script for web scraping but is still relevant as most of the workarounds offered on the answers pointed to the same type of script.


Some questions having answers working on January 5th 2024

Historical data

Other

  • Import data from yahoo finance to Google sheets
    • The answer to this questions uses a URL that delivers historical data as CSV (a similar URL as the used on the first question on this list). It's not what the OP was asking. Closed as duplicate of **

** Scraping data to Google Sheets from a website that uses JavaScript


Resources

Related

Yahoo recently pulled the plug on their stocks API. What are "Yahoo-finance" related posts and its tag's fates?

4
  • 3
    What are you asking here? Or what are you looking to discuss? If you've found a bad answer, downvote it.
    – Thom A
    Commented Jan 4, 2023 at 9:08
  • 7
    "I'm wondering which could be the best question to be used as the duplicate target for questions repeating the same pattern" would writing one yourself be an option?
    – Mast
    Commented Jan 4, 2023 at 9:47
  • 1
    @Mast I posted a comment on an answer of the experts of google-sheets + yahoo-finance questions with the highest number of answers well received and complete asking them if their last answer could be a good canonical answer. After reading their reply I'm considering to write one.
    – Wicket
    Commented Jan 4, 2023 at 17:19
  • A community wiki question that both google-sheets and yahoo-finance SMEs work together on would be the best option IMO Commented Jan 5, 2023 at 17:48

0

You must log in to answer this question.

Browse other questions tagged .