用查询公式编写setFormula() [英] Writing a setFormula() with a query formula

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

问题描述

晚上好,我在单元格中有一个公式:

Good evening, I have a formula in a cell:

=query(IMPORTRANGE("1O9JBXnSpnigfVpMqNHq6nHcaHb7VwdroDgzDqfnD8iM";"'Tableau detail'!$b$3:$c");"select Col2 where (Col1='"&'Feuille 1'!$E$12&"')")

我想将其集成到带有setformula()的脚本中.我尝试过以下写作:

I would like to integrate it into a script with setformula (). I tried with this writing:

formuleNombre.setFormula('= query(IMPORTRANGE("1O9JBXnSpnigfVpMqNHq6nHcaHb7VwdroDgzDqfnD8iM";''Tableau detail'!$ b $ 3:$ c");选择Col2,其中(Col1''eu&!$ E $ 12&')")');

但是它不起作用:(我有这个错误:

but it does not work :( I've this error :

公式分析错误.

我也尝试过这个:

formuleNombre.setFormula('= query(IMPORTRANGE("1O9JBXnSpnigfVpMqNHq6nHcaHb7VwdroDgzDqfnD8iM";"\'Tableau detail \'!$ b $ 3:$ c");选择Col2,其中(Col1 ='&Feuille 1 \'!$ E $ 12&')")');

我有这个错误

参数列表后缺少

Sign).(第56行,文件代码")

Sign) missing after the argument list. (line 56, file "Code")

第56行是上面有公式的行.....我根本看不到,或者这个错误在哪里.

Line 56 is the line where there is the formula above..... I do not see at all or where this error is.

你能帮我吗?

Cordially.

Cordially.

推荐答案

出现此错误的原因是由于''.

The reason you are having this error is because of the ' '.

您需要在 setFormula 中输入的公式必须是字符串,并且输入的内容是:

The formula you need to input in the setFormula must be a string, and what you give is:

'=query(
    IMPORTRANGE(
        "1O9JBXnSpnigfVpMqNHq6nHcaHb7VwdroDgzDqfnD8iM";
        "'Tableau detail'!$b$3:$c"
    );
    "select Col2 where (Col1='"&'Feuille 1'!$E$12&"')"
)'

您的字符串在单引号之间,但是其中有单引号.您需要转义字符串的所有单引号,例如.

You string is between single quotes, but you have single quotes in it. You'll need to escape all the single quotes of the string, something like.

'=query(IMPORTRANGE("1O9JBXnSpnigfVpMqNHq6nHcaHb7VwdroDgzDqfnD8iM";"\'Tableau detail\'!$b$3:$c");"select Col2 where (Col1=\'"&\'Feuille 1\'!$E$12&"\')")'

这篇关于用查询公式编写setFormula()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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