Google表格应用脚本由于报价原因无法设置带有查询功能的公式 [英] Google Sheets Apps Script unable to set formula with a query function due to quotations
问题描述
我当前的代码是
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 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 javascript provides 2 ways to assign strings: In your case, double quotes are a part of the string, and the quickest way is to use the string inside single quotes: The other way is to use escape symbol: Please, see more info here: 这篇关于Google表格应用脚本由于报价原因无法设置带有查询功能的公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!'string'
var text = 'string ... "" ... string'
var text = "string ... \"\" ... string"
var formulas = "=iferror(QUERY(bridgePriceCase!$A$1:$F,"select F where A = "&"'"&$C2&"'"& " and B = "&$G2&" and C = "&$F2,0),0)"
"string"
'string'
var text = 'string ... "" ... string'
var text = "string ... \"\" ... string"