0
votes

I'm trying to pull the data displayed in the table linked below (Fangraphs) over to my Google sheet.

Link to a table on the website:

https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0

Using ImportHTML, I'm only able to pull up tables #1,2,3 from the link, none of them are the correct tables.

Using ImportXML, I keep getting formula parse error using the code:

=IMPORTXML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0","//*[@id="react-drop-test"]/div[2]/div/div[1]/div/div[1]/table)")

Code I've tried:

ImportHTML:

=IMPORTHTML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0", "table",4)

ImportXML:

=IMPORTXML("https://www.fangraphs.com/leaders/splits-leaderboards?splitArr=8,131&splitArrPitch=&position=B&autoPt=false&splitTeams=false&statType=player&statgroup=2&startDate=2014-03-01&endDate=2019-11-01&players=&filter=AB%7Cgt%7C5&sort=16,1&pageitems=10000000000000&pagenum=0","//*[@id="react-drop-test"]/div[2]/div/div[1]/div/div[1]/table)")```

I want the table headers and all the data below to be pulled into my Google sheet.  I've done this with other Fangraph links.
1

1 Answers

0
votes

unfortunately, that won't be possible because the site is controlled by JavaScript and Google Sheets can't understand/import JS. you can test this simply by disabling JS for a given link and you will see a blank page:

0