Google Sheets Apps Script unable to set formula wi

2019-08-05 09:20发布

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

1条回答
叼着烟拽天下
2楼-- · 2019-08-05 09:49

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:

查看更多
登录 后发表回答