admin管理员组文章数量:1303404
I have recently started writing some scripts for Google Spreadsheets. I have no experience with Javascript though and I have question that is concerning a (as I suppose) basic issue.
I would like my script to insert data shown below into a cell in a sheet. How should I encode it to make it work?
komorkaLinku.setValue("=HYPERLINK("/some/data"+variable+"something","something")");
I had tried several ways but none of them worked.
I have recently started writing some scripts for Google Spreadsheets. I have no experience with Javascript though and I have question that is concerning a (as I suppose) basic issue.
I would like my script to insert data shown below into a cell in a sheet. How should I encode it to make it work?
komorkaLinku.setValue("=HYPERLINK("http://www.some.link/some/data"+variable+"something","something")");
I had tried several ways but none of them worked.
Share Improve this question edited Jul 12, 2013 at 14:31 CharlesB 90.5k29 gold badges201 silver badges228 bronze badges asked Jul 12, 2013 at 14:10 Grzegorz G.Grzegorz G. 4273 gold badges6 silver badges15 bronze badges1 Answer
Reset to default 6You are trying to include quotes inside quoted text. There are a couple of ways to do that.
Use single quotes inside double quotes, or vice-versa.
komorkaLinku.setValue('=HYPERLINK("http://www.some.link/some/data'+variable+'"something","something")');
Use escaped single quotes.
komorkaLinku.setValue('=HYPERLINK(\'http://www.some.link/some/data'+variable+'\'something\',\'something\')');
As @ScampMichael ments, it would be a better choice to use setFormula()
in this case. You would still need to handle embedded quotes properly.
本文标签: javascriptInsertion of brackets and quotation marks using Google Apps ScriptStack Overflow
版权声明:本文标题:javascript - Insertion of brackets and quotation marks using Google Apps Script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741673468a2391741.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论