过滤 IMPORTHTML 数据

Filter IMPORTHTML data

当我导入数据时,它采用这种格式 (image 1),带有空格。我想知道是否有任何方法可以调整以使这些空白消失,预期的两个模型(图像 2 和 3)如果有任何方法可以到达它们将很重要我。

记住所有日期都有 / 并且所有时间都有 :

我尝试从 QUERY 过滤,但是当尝试 "Select Col1, Col2, Col4 Where Col2 is not null" 时,日期消失,只剩下时间,我尝试通过 REGEXMATCH 将日期与时间分开使用/: 但我也没有成功。

我也通过 IMPORTXML 尝试过,但有些数据最终无法正确导入网站的某些页面,因为 IMPORTHTML 这些错误不会发生。我使用的 XML's 是:

"//tr[@class='no-date-repetition-new' and ..//td[@class='team team-a']] | //tr[@class='no-date-repetition-new live-now' and ..//td[@class='team team-a']]"
"//td[@class='team team-a']/a | //td[@class='team team-a strong']/a"

当前公式如下:
=IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1)

IMPORTHTML 原文:

预期格式:
---

您需要的不是过滤,而是重组导入的数据。

无论如何,我认为更容易获得最终结果的解决方案是使用多个 IMPORTXML 公式。

URL
A1: https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/

Headers
A2: //table[contains(@class,'matches')]/thead/tr/th


A3: //td[contains(@class,'date')]/parent::tr

球队和得分
A4: //td[contains(@class,'team-a')]/parent::tr

A6: =transpose(IMPORTXML($A,A2))
A7: =IMPORTXML($A,A3)
B7:=IMPORTXML(A1,A4)

您可能想用静态值替换 A6 上的公式,以便正确放置它们。

您可以在一个公式中将 2 个查询连接在一起(一个并排),以获得您的结果

={QUERY(IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1), 
    "select Col1 where Col2 is null and not Col1 contains '*'",1), 
QUERY(IMPORTHTML("https://int.soccerway.com/national/austria/1-liga/20192020/regular-season/r54328/","table",1), 
    "select Col1, Col2, Col3, Col4 where Col2 is not null label Col1 'Time'",1)}

公式的工作原理:

  1. 如您所见,两个查询的数据部分在两个查询中是相同的。实际上不同的是“我们从查询中要求的”
  2. 在第一个中我们使用 "select Col1 where Col2 is null and not Col1 contains '*'"
  3. 第二个"select Col1, Col2, Col3, Col4 where Col2 is not null label Col1 'Time'"
  4. 我们通过将它们连接在一起来创建一个数组,如 ={1stQUERY,2ndQUERY}