1
votes

I import data from a single IMPORTXML and divide it into two columns as follows:

=ArrayFormula(IFERROR(HLOOKUP(1,{1;IMPORTXML(A1,"

//table[@class='table squad sortable']//td[@class='photo']/a/img/@src | 
//table[@class='table squad sortable']//td[@class='name large-link']/a/@href")},

(ROW(A:A)+1)*2-TRANSPOSE(sort(ROW($A$1:$A$2)+0,1,0)))))

enter image description here

I would like to know if there is any way of not having to use more than one call to importxml and adding the IMAGE function only in the first column, so I don't have to put it separately as I currently do.

link to Spreadsheet: https://docs.google.com/spreadsheets/d/10_G3QjcLcE9dYz_0m8PjPxHDAAaKL7BGEehTfmprYTQ/edit?usp=sharing

1

1 Answers

0
votes

best you can do with one formula would be:

=ARRAYFORMULA({IFERROR(IMAGE(IMPORTXML(A1,
 "//table[@class='table squad sortable']//td[@class='photo']/a/img/@src"))), 
 QUERY(IFERROR(HLOOKUP(1, {1; IMPORTXML(A1,
 "//table[@class='table squad sortable']//td[@class='photo']/a/img/@src | //table[@class='table squad sortable']//td[@class='name large-link']/a/@href")},
 (ROW(A:A)+1)*2-TRANSPOSE(SORT(ROW($A$1:$A$2)+0, 1, 0)))), "where Col1 !=''", 0)})

0