连接 IMPORTXML 导入的两列,并在每行的值之间使用"&&&&&"分隔符(Google 表格)



IMPORTXML导入的数据分为两列,我想将第1列的文本与第2列的文本合并:

示例:

textone      texttwo  
textthree    textfour

预期结果:

textone&&&&&textwo  
textthree&&&&&textfour

当前使用的公式:

=ArrayFormula(iferror(hlookup(1,{1;IFERROR(IMPORTXML("https://int.soccerway.com/national/netherlands/eerste-divisie/20202021/regular-season/r57945/","//td[@class='team team-a'] | //td[@class='team team-a strong']/a | //td[@class='team team-a']/a/@href | //td[@class='team team-a strong']/a/@href"))},(row(A:A)+1)*2-transpose(sort(row(A1:A2)+0,1,0)))))

您可以使用一点正则表达式魔术。假设第二列中的所有内容都以"/团队":

=TRANSPOSE(
SPLIT(
JOIN(,
ArrayFormula(
REGEXREPLACE(
IMPORTXML(
"https://int.soccerway.com/national/netherlands/eerste-divisie/20202021/regular-season/r57945/",
"//td[@class='team team-a'] | //td[@class='team team-a strong']/a | //td[@class='team team-a']/a/@href | //td[@class='team team-a strong']/a/@href"
),
"(/teams.*)",
"&&&&&$1;"
)
)
),
";"
)
)

最新更新