Google表格应用脚本由于报价原因无法设置带有查询功能的公式 [英] Google Sheets Apps Script unable to set formula with a query function due to quotations

查看:50
本文介绍了Google表格应用脚本由于报价原因无法设置带有查询功能的公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的代码是

var formulas = "=iferror(QUERY(bridgePriceCase!$A$1:$F,"select F where A = "&"'"&$C2&"'"& " and B = "&$G2&" and C = "&$F2,0),0)"

但是我收到一个错误消息,提示"Missing; before statement".我知道这与查询的选择"部分中使用的引号有关,但是尝试了几种解决方案后,我似乎无法弄清楚双引号和/'的组合才能使其正常工作. /p>

感谢您的帮助

解决方案

  • My current code is

    var formulas = "=iferror(QUERY(bridgePriceCase!$A$1:$F,"select F where A = "&"'"&$C2&"'"& " and B = "&$G2&" and C = "&$F2,0),0)"
    

    But i get an error that says "Missing ; before statement". I understand it has to do with the quotations used in the 'select' part of the query, but after trying a few solutions, i can't seem to figure out the combination of double quotes and /' to get it to work.

    Any help is appreciated

    解决方案

    provides 2 ways to assign strings:

    1. double quotes: "string"
    2. single quotes: 'string'

    In your case, double quotes are a part of the string, and the quickest way is to use the string inside single quotes:

    var text = 'string ... "" ... string'

    The other way is to use escape symbol:

    var text = "string ... \"\" ... string"

    Please, see more info here:

    这篇关于Google表格应用脚本由于报价原因无法设置带有查询功能的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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