如何将 IMPORTRANGE() 数组转换为字符串,以便在 QUERY() 中使用?

huangapple go评论77阅读模式
英文:

How to convert an IMPORTRANGE() array to a string, for use with QUERY()?

问题

我遇到了与此处讨论的相同问题,只是我使用IMPORTRANGE()而不是直接的数组引用(例如D12:I119)。我需要QUERY()将其输入理解为字符串数组。但是,我的尝试在IMPORTRANGE()后面添加一个空字符串(&""),如链接中建议的那样,没有奏效:

QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/...", "Sheet1!A3:1000")&"", "select Col1, Col2")

除此之外,我还有其他方法可以解决这个问题吗?不幸的是,我无法更改IMPORTRANGE()引用的电子表格上的数据。

英文:

I have the same problem which is discussed here, except that I am working with IMPORTRANGE() instead of a direct array reference (e.g., D12:I119). Somehow I need QUERY() to understand its input as an array of strings. But my attempt to addend a null string (&"") to IMPORTRANGE(), as suggested in the link, doesn't work:

QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/...","Sheet1!A3:1000")&"","select Col1, Col2")

How else can I get around this? Unfortunately, I can't change the data on the spreadsheet referenced by IMPORTRANGE().

答案1

得分: 4

=INDEX(QUERY(TO_TEXT(IMPORTRANGE("https://docs.google.com/spreadsheets/d/...",
"Sheet1!A3:1000")),
"select Col1, Col2", ))

英文:

use:

=INDEX(QUERY(TO_TEXT(IMPORTRANGE("https://docs.google.com/spreadsheets/d/...", 
 "Sheet1!A3:1000")), 
 "select Col1, Col2", )

huangapple
  • 本文由 发表于 2023年5月21日 03:13:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76296958.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定