0
votes

I am trying to import

https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0

into a Google sheet and clean it up so their are three columns, one for player id, the next name and the next team.

I have input the formula into google sheets how I thought it should work but my syntax is wrong because I get the error

Imported content is empty.

I am not targeting the right data and I'm not sure how to do it exactly here.

The formulas I am using are:

=IMPORTXML("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0","//span[@class='html-attribute-value']")

=IMPORTXML("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0","//span[@class='html-attribute-value']")```

=IMPORTXML("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0","//span[@class='html-attribute-value']")```

Here is my Google sheet: https://docs.google.com/spreadsheets/d/1W0Bt5z-Tky-tNhG_JtfE4FfjTRgQNRu_eQu2qVhQ-_E/edit?usp=sharing

1

1 Answers

1
votes

try:

=ARRAYFORMULA(IFERROR(QUERY({
 REGEXEXTRACT(INDEX(IMPORTDATA("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0"),,1), "id=""(.+?)"""),
 REGEXEXTRACT(INDEX(IMPORTDATA("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0"),,1), "name=""(.+)")&" "&
 REGEXEXTRACT(INDEX(IMPORTDATA("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0"),,2), "(.+?)"""),
 REGEXEXTRACT(INDEX(IMPORTDATA("https://www67.myfantasyleague.com/2019/export?TYPE=players&DETAILS=&SINCE=&PLAYERS=&JSON=0"),,2), "team=""(.+?)""")}, 
 "offset 3")))

enter image description here

spreadsheet demo