简体   繁体   English

setValue到QUERY()公式不起作用?

[英]setValue to QUERY() formula doesn't work?

Part of my spreadsheet's script runs the following piece of code: 电子表格脚本的一部分运行以下代码:

temp.getRange(1, 1).setValue("=QUERY(data!A1:H125, \"Select A\")");

As you might expect, this puts =QUERY(data!A1:H125, "Select A") into the A1 cell BUT the formula gives an error (#NAME, error: Unknown range name data!A1) . 如您所料,这会将=QUERY(data!A1:H125, "Select A")放入A1单元格,但公式会给出错误(#NAME, error: Unknown range name data!A1) I know the formula is correct because if I copy and paste it into the neighboring cell everything works fine. 我知道该公式是正确的,因为如果我将其复制并粘贴到相邻的单元格中,则一切正常。 I do have a sheet called 'data' and it is full of data in the range A1:H125. 我确实有一个名为“数据”的工作表,里面充满了A1:H125范围内的数据。

Any help on this problem would be greatly appreciated. 在这个问题上的任何帮助将不胜感激。

I found the answer on the Google support forums. 我在Google支持论坛上找到了答案。 The setFormula function is required rather than the setValue function. 需要setFormula函数,而不是setValue函数。

ie. 即。 temp.getRange(1, 1).setFormula("=QUERY(data!A1:H125, \\"Select A\\")"); should work 应该管用

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

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