I used the following formula for almost a year now and suddenly it stopped working and is not importing the table.
=IMPORTHTML("https://tradingeconomics.com/matrix";"table";1)
It gives me a "Could not fetch url: https://tradingeconomics.com/matrix error. I also tried the importXML function - same problem.
I tried https://www.octoparse.com just to see if it was able to scrape the data. And it is able to scrape and parse out the data and export it to various formats (you need to install a program for it), although it doesn't solve the problem of automatically importing into Sheet via formula. 😕
Any ideas about what the problem could be and how I need to adapt the formula?
Note: I can't code, unfortunately.
There have being several posts here and other places about the same error message realted to IMPORTHTML. Here are some previous questions bout the same error message that were fixed without making any change:
Google spreadsheet importHTML Could not fetch URL
"Could not fetch URL" using IMPORTHTML
Sometimes the problem is caused by something on the Google side and there isn't any change that can be done on the formula to fix it, the only thing to do is to report the problem to Google from the help menu and wait. At this time the option is shown to me as "Help Sheets improve" but this might change without any notice as it has being done several times.
You might also report it through the official Google Editors Help forum.
Related
How to know if Google Sheets IMPORTDATA, IMPORTFEED, IMPORTHTML or IMPORTXML functions are able to get data from a resource hosted on a website?
try cached version:
https://webcache.googleusercontent.com/search?q=cache:ZNJKOXQm2t4J:https://tradingeconomics.com/matrix+&cd=2&hl=en&ct=clnk
=IMPORTHTML("https://webcache.googleusercontent.com/search?q=cache:https://tradingeconomics.com/matrix", "table", 1)
Related
I am trying to import this table into a Google Spreadsheet:
The table is available here:
https://competitions.lta.org.uk/sport/drawsheet.aspx?id=8D598CDE-8579-4541-B7AD-48558BF6FEA3&draw=4
Before Google changed their Spreadsheet addresses, I had the import working with ImportHTML(URL, "table", 2) - but this no longer works, even though there appears to be only two 'table' labels in the page HTML.
Looking for a way to abstract the table, I went to 'importXML' but tried several versions like 'importxml("https://competitions.lta.org.uk/sport/drawsheet.aspx?id=8D598CDE-8579-4541-B7AD-48558BF6FEA3&draw=4", "//div[contains(#id,'poule')]")'
and the same first part of the statement with "//table[contains(#class,'ruler')]")
but the formula fails with 'no content'
Would really appreciate some help to find a way to import this table!
Thanks in anticipation,
The reason you can't get the table data is because of the cookies page
Every time Google Sheets is trying to access that link, you need to accept cookies, and by default, Google Sheets won't do it.
You need to bypass or accept the cookies from the website to access data, you will need to implement more advanced things in Python or Google Apps Script
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
I have a Google Sheets document where I track the prices of several stocks. I made this a couple of months ago, and have been experiencing this issue for the past couple of weeks:
This formula returns "#N/A", the error description is: "Could not fetch url: https://finviz..."
=substitute(INDEX(IMPORTHTML("https://finviz.com/quote.ashx?t=VOO","table",11),8,2),"*","")
However, if I create a new Google Sheets document and use this exact formula, it works. Does anyone know what could be the problem?
I am having the same issue. Something must have been changed at finviz / google :(
There are also some discussions in the google support groups.
One possible solution could be to put all the symbols you're interested in into one URL, e.g. https://finviz.com/screener.ashx?v=161&t=FB,AAPL,GOOG,TSLA&ta=0&p=w
and then parse the resulting table.
Unfortunately I am not very good at the parsing part and have to do it by try and error.
But for example
=importxml("https://finviz.com/screener.ashx?v=161&t=FB,AAPL,GOOG,TSLA&ta=0&p=w";"//*[#id='screener-content']/table/tbody/tr[4]/td/table")
is at least showing some results in google docs. So this might be something to work with.
It will work again by removing 'SUBSTITUTE' and switching to table 8.
A2 = stock ticker
=ÍNDICE(IMPORTHTML("https://finviz.com/quote.ashx?t="&A2;"table";8);7;2)
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.
I've been able to query from a Google Sheets table just fine for the past 6 months to a year and then all of a sudden I'm receiving the error: "Found corrupted data while opening file." Does anyone know why this is occurring even though there were no changes made to the Google Sheet.
I had the same problem. My tables' source format was CSV while using a spreadsheets.
To solve it, I deleted the table and recreated it with "Google Sheet" as source format.
For other tables I couldn't delete, I changed the source format by making a REST call.
https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/update
Both solutions worked.
this happens occasionally...the error is on Google's side. the best course of action is to contact Google Sheets support and request recovery of your spreadsheet. it may take them 1-3 weeks to do so.