0

I am trying to get stock info from Yahoo Finance with the function importxml in google sheets. How can I get to the revenue row?

https://finance.yahoo.com/quote/AMZN/financials?p=AMZN From this page I would like to go down to income statement and get total revenue for the last 3 years.

First I click inspect the page and copy the full xpath. Then I add it to the formula importxml in google sheets:

=IMPORTXML(
 "https://finance.yahoo.com/quote/AMZN/financials?p=AMZN";
 "/html/body/div[1]/div/div/div[1]/div/div[3]/div[1]/div/div[2]/section/div[3]/div[1]/div/div[2]/div[1]/div[1]/div[2]")

but it says:

#N/A Error - Resource at url not found

Rubén
  • 34,714
  • 9
  • 70
  • 166
zindylou
  • 1
  • 1
  • I had a similar error once. For me, it turned out Google was blocking the request. Seems they don't want to platform screenscraping applications. – Paulb Jan 23 '23 at 18:27
  • 1
    Does this answer your question? [Scraping data to Google Sheets from a website that uses JavaScript](https://stackoverflow.com/questions/74237688/scraping-data-to-google-sheets-from-a-website-that-uses-javascript) – Rubén Jan 23 '23 at 19:16
  • I have to apologize for my poor English skill. Unfortunately, from `From this page I would like to go down to income statement and get total revenue for the last 3 years.`, I cannot understand your expected values. Can I ask you about the detail of your expected values? – Tanaike Jan 24 '23 at 01:03

0 Answers0