仅当在“ // tr”内部还存在“ // tr / td [@ class ='Y']”时,ImportXML“ // tr / td [@ class ='X']”

时间:2019-09-02 20:46:02

标签: regex xpath google-sheets google-sheets-formula google-sheets-importxml

示例:我要制作importXML(Google表格功能)的页面具有以下结构(状态和得分→Td类):

<tr class=class="odd  expanded    match no-date-repetition"
   <td class="date no-repetition"
   <td class="score-time status"

<tr class=class="odd  expanded    match no-date-repetition"
   <td class="date no-repetition"
   <td class="score-time score"

<tr class=class="odd  expanded    match no-date-repetition"
   <td class="date no-repetition"
   <td class="score-time status"

对于td class =“ date no-repeat”中存在的数据,但没有紧随其后的td class =“ score-time status”,我不需要,我想知道是否有任何方法可以过滤器仅在“ TR”内部存在“ date no-repeat”和“ score-time status”类时才导入“ home” ...该站点没有固定的数据位置,因此我无法通过选择date no-repeat来工作[1]日期不重复[3]日期不重复[5]定义要导入的“家”。

1 个答案:

答案 0 :(得分:0)

=ARRAYFORMULA(TRANSPOSE(SPLIT(CONCATENATE("♦"&TEXT(REGEXEXTRACT(
 IMPORTXML(A4, A3), "\d+/\d+/\d+"), "dd/mm/yyyy")&"♦"&IMPORTXML(A4, A3)), "♦")))

enter image description here

或简单:

=ARRAYFORMULA({TEXT(REGEXEXTRACT(
 IMPORTXML(A4, A3), "\d+/\d+/\d+"), "dd/mm/yy"),IMPORTXML(A4, A3)})

0