【问题标题】:How can I escape double and single quotes in google sheets query?如何在谷歌表格查询中转义双引号和单引号?
【发布时间】:2018-12-20 07:48:03
【问题描述】:

我在谷歌表格单元格中有这个查询:

=QUERY(Sheet1!A2:F, "SELECT * WHERE A='te'xt"text'", 0)

我可以像这样转义双引号:text""text

但是我怎样才能转义双引号和单引号呢? te'xt"text

【问题讨论】:

标签: google-sheets google-sheets-query google-sheets-formula


【解决方案1】:

一种可能的替代方法是进行一些预处理(在查询之前)

=ArrayFormula(QUERY({regexmatch(Sheet1!A2:A, "te\'xt"&char(34)&"text"),Sheet1!A2:F}, "Select Col2, Col3, Col4, Col5, Col6,Col7  where Col1 = true", 0))

正则表达式匹配将为匹配模式的所有行返回“true”。然后 query() 只选择 Col1 中具有 'true' 的行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-13
    • 2013-06-30
    • 1970-01-01
    • 1970-01-01
    • 2011-01-03
    • 1970-01-01
    • 2017-01-08
    相关资源
    最近更新 更多