setValue到QUERY()公式不起作用? [英] setValue to QUERY() formula doesn't work?

查看:61
本文介绍了setValue到QUERY()公式不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

部分电子表格脚本运行以下代码片段:

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

正如您所料,这会将 = QUERY(data!A1:H125 ,选择A)到A1
单元格中,但公式给出错误(#NAME,错误:未知范围名称数据!A1)
我知道公式是正确的,因为如果我将它复制并粘贴到相邻的
单元格中,一切正常。我确实有一张名为'data'的工作表,其中包含A1:H125范围内的
数据。



有关此问题的任何帮助将不胜感激。

解决方案

我在Google支持论坛上找到了答案。 setFormula函数是必需的,而不是setValue函数。



即。 temp.getRange(1,1).setFormula(= QUERY(data!A1:H125,\Select A \)); p>

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). 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.

Any help on this problem would be greatly appreciated.

解决方案

I found the answer on the Google support forums. The setFormula function is required rather than the setValue function.

ie. temp.getRange(1, 1).setFormula("=QUERY(data!A1:H125, \"Select A\")"); should work

这篇关于setValue到QUERY()公式不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆