XPath for specific site in Google Sheets - xpath

I want to import table shows in below link:
https://www.codal.ir/ReportList.aspx?search&LetterType=6&AuditorRef=-1&PageNumber=1&Audited&NotAudited&IsNotAudited=false&Childs=false&Mains&Publisher=false&CompanyState=0&Category=1&CompanyType=1&Consolidatable&NotConsolidatable=false
it is not possible by importhtml, and I have tried some xpaths by importxml but failed.

this is not an issue of XPath. the website you are trying to scrape is dependant on JavaScript. Google Sheets does not support import of JS elements. your only option is to find the same data you need on some other website. you can test the JS dependency simply by disabling it for a given site and what's left of it can be scraped - in your case, nothing:

Related

How to import website graph data into google sheets

Essentially I'm working on a presentation and I would like to import this graph into google sheets it does not have to look the same I just need the data. I don't program in HTML so I'm not really sure what to do does anyone have ideas on how I could extract this graph data.
https://digitalik.net/btc/sf_model/#
I've tried using google sheets built-in HTML graph function but for some reason, it can't detect it so an alternative would be to download the data as an XML and paste it into sheets so that's also an option.
unfortunately not possible for a given site because it uses JavaScript and Google Sheets does not support web scraping of JS elements. you can test this simply by disabling JS for a given site and what's left can be scraped. in your case its nothing:

Google Sheets ImportXML Error: Imported XML content cannot be parsed

I'm trying to import stock suggestions into a spreadsheet and have successfully done so from 3 websites, but I am struggling with the 4th.
=IMPORTXML("https://www.tipranks.com/stocks/amzn/price-target","//h3[#class='client-components-stock-research-analysts-analyst-consensus-style__buy'")
Is the command I'm using to try to pull the tag under "Analyst Consensus Rating" from https://www.tipranks.com/stocks/amzn/price-target. But I keep getting:
Error Imported XML content can not be parsed.``` Tips for what I'm doing wrong would be highly appreciated
Google Sheets does not support web scraping of JavaScript controlled elements. you can easily check it by disabling JS for a given site and only what's left visible can be scraped. unfortunately, in your case, that's nothing:

Google Sheets Import Function from Fortune 500

I'm trying to import the table of Fortune 500 companies for 2019 into Sheets. I've tried the formula
=IMPORTXML("https://fortune.com/fortune500/2019/search/","//div[#class='ReactTable']")
and some variations of this function but can't get it correct. Any help please?
the website you trying to scrape is under JavaScript control. Google Sheets is not capable of importing JS elements. you can test this simply by disabling JavaScript for a given site and what you are left with is able to be scraped. in your case: nothing:

IMPORTHTML or IMPORTXML to collect data from a site

I have made several attempts to collect the data within this table:
The simple ways of the two functions I've commented on, I've tried, but not succeeded.
I would like to if anyone knows any other way to collect this data in Google Sheets.
Site Link:
https://www.onlinebettingacademy.com/stats/team/brazil/operrio-pr/13217#tab=t_squad
the table you want to scrape is under JavaScript control, therefore, it can't be scraped.
all you can get from that site into Google Sheets is:
=ARRAY_CONSTRAIN(IMPORTDATA(
"https://www.onlinebettingacademy.com/stats/team/brazil/operrio-pr/13217#tab=t_squad&team_id=13217"); 10000; 10)
Because the page you are trying to scape is rendered using Javascript — i.e. the content you are looking to scrape is not in the markup, you will not be able to use a tool like Google Sheets.
However... you can easily scrape this by using a "headless browser". You pretty much will use a browser (without a UI) that will render your URL with the Javascript, and then once the page is loaded, you query the data using XPATH, etc.
Check out Puppeteer for an example of a JS framework that you can use for this task.

Stuggling to import from BarChart website

I'm struggling to import data from the barchart.com website
I have tried importing the data presented on barchart.com/stocks/sectors/rankings?timeFrame=matrix without success.
I have tried using IMPORTHTML and IMPORTXML but neither works and I've tried various inputs.
If someone can please assist.
this won't be possible. values which you want to scrape are controlled by JavaScript and Google Sheets does not support JS scraping. you can always test this by temporarily disabling JS on given URL to see what's possible to scrape:

Resources