I am having a hard time getting the xpath for this link.
Pls help get the right xpath of the upload and download speed values. Thank you in advance.
there isn't such XPath that would work because IMPORTXML does not support scrapping JavaScript elements. see:
workaround is to use different non-JS site
Related
I'm trying to see if it's possible to scrape data from Transfermarkt.com to import into a Google Sheets doc.
Currently, I'm trying to import the team data from a player's profile page (see example URL here: https://www.transfermarkt.co.uk/joao-palhinha/profil/spieler/257455) but in future may want to import other data as well.
I wonder if it's possible to scrape data in this way from Transfermarkt, but if it is, any advice on what I'm doing wrong would be very much appreciated!
Right now I'm using, =IMPORTXML(B1,"/html/body/div[3]/main/header/div[4]/div/span[1]/a") where the URL is in B1. I copied the Full XPath from the HTML, but have also tried this by copying just the XPath too.
It says Loading for a few seconds before returning N/A, with an error message 'Resource at URL not found'.
I'm expecting the result in this instance to be Fulham.
Thanks
how to extract data to google sheets from XPath not working sites like p2p.binance.com ?
I use to selectorgadget chrome extension to get XPath on websites but it's not working for this site https://p2p.binance.com/en/trade/sell/USDT?fiat=LKR&payment=ALL or even any page in Binance.
Binance API does support this page and please give me a solution to this. It would be a very good help.
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 need to scrape the content of the page:
https://www.otcmarkets.com/stock/GBTC/security
in a Google spreadsheet, so that I can further elaborate that.
I failed miserably,
can you help me?
Thank you!
If you want to scrape a web page in Google Sheets, you might benefit from making use of one of the formulae below:
IMPORTHTML which is used to import data from a table or list within an HTML page;
IMPORTXML which is used to import data from any of various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds.
However, if the content you want to retrieve is dynamic, you might need to look for other alternatives as both of these commands read the HTML source of the page without any JavaScript code associated with it and without executing it.
Reference
Google Sheets IMPORTHTML;
Google Sheets IMPORTXML.
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.