You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何修改Google Sheets公式仅导入首个匹配timestamp的列?

提取首个"timestamp"列的公式方案

直接替换成以下公式即可精准提取第一列名为"timestamp"的数据:

=LET(
  data, IMPORTRANGE("MY_ID", "SHEET!1:1000"),
  header_row, INDEX(data, 1),
  first_col, XMATCH("timestamp", header_row),
  INDEX(data, , first_col)
)

逻辑说明:

  • XMATCH("timestamp", header_row) 会直接返回第一行中第一个匹配"timestamp"的列索引,默认按从左到右顺序查找首个匹配项
  • INDEX(data, , first_col) 里的逗号留空代表取该列的所有行,first_col指定要提取的目标列位置

如果要处理未找到"timestamp"列的报错情况,可以加容错判断:

=LET(
  data, IMPORTRANGE("MY_ID", "SHEET!1:1000"),
  header_row, INDEX(data, 1),
  first_col, IFNA(XMATCH("timestamp", header_row), 0),
  IF(first_col>0, INDEX(data, , first_col), "未找到timestamp列")
)

内容的提问来源于stack exchange,提问作者James N.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 15:57:09