简体   繁体   English

使用谷歌表格中的查询过滤导入范围(时间戳问题)

[英]filtering an importrange with a query in google sheets (timestamp troubles)

I have a dashboard that is pulling audit data from another sheet that has entries coming in continuously over the week.我有一个仪表板,它从另一个工作表中提取审计数据,该工作表的条目在一周内不断传入。 This gets to be 15k+ entries and is really slowing things down.这将成为 15k+ 个条目,并且确实减慢了速度。 I want to import the audit data to my dashboard, but only the audits from today.我想将审计数据导入我的仪表板,但只导入今天的审计。 Here is what I have so far这是我到目前为止所拥有的

=QUERY(IMPORTRANGE(URL, "audit_data!A1:f"), "Select Col1, Col2, Col3, Col4, Col5, Col6 where Col1 = date '"&TEXT(G1,"yyyy-mm-dd")&"'",0)

the cell G1 that is referenced is被引用的单元格 G1 是

=text(today(), "yyyy-mm-dd") 

which I realize may be redundant.我意识到这可能是多余的。 This keeps returning with an empty output and I think it's because the audit data I am importing has the timestamp in 2/25/2020 18:37:50.这不断返回空输出,我认为这是因为我导入的审计数据的时间戳为 2/25/2020 18:37:50。 any way around that?有什么办法吗?

try:尝试:

=ARRAYFORMULA(QUERY({IMPORTRANGE(A1, "audit_data!A1:F"), 
      IFNA(DATEVALUE(IMPORTRANGE(A1, "audit_data!A1:A")))}, 
 "select Col1,Col2,Col3,Col4,Col5,Col6 
  where Col7 = "&DATEVALUE(G1), 0))

0


or:或者:

=QUERY(IMPORTRANGE(A1, "audit_data!A1:F"), 
 "select Col1,Col2,Col3,Col4,Col5,Col6 
  where Col1 >= date '"&TEXT(G1,   "yyyy-mm-dd")&"'
    and Col1 <= date '"&TEXT(G1+1, "yyyy-mm-dd")&"'", 0)

0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM