admin管理员组文章数量:1318335
Looking for something in google apps script that does something similar to ES6 javascript.
Ss.main.getRange('C2').setValue('${Ss.main.getRange(2,2).getDisplayValue()}')
expected C2 cell to equal the value in B2. instead i get ${Ss.main.getRange(2,2).getDisplayValue()}
Looking for something in google apps script that does something similar to ES6 javascript.
Ss.main.getRange('C2').setValue('${Ss.main.getRange(2,2).getDisplayValue()}')
expected C2 cell to equal the value in B2. instead i get ${Ss.main.getRange(2,2).getDisplayValue()}
- Although I'm not sure whether I could correctly understand about your question, do you want to copy the value of "B2" to "C2" using Google Apps Script? – Tanaike Commented Apr 12, 2019 at 0:53
2 Answers
Reset to default 5Look at there: V8 Runtime Overview
Example:
// V8 runtime
var name = `Hi ${first} ${last}.`;
var url = `http://localhost:3000/api/messages/${id}`;
The current version of Apps Script does not support ES6 string literals (but that will change with the uping V8 upgrade, hopefully in the near future). In the meantime, you can leverage the Utilities.formatString()
function.
Your sample code can be converted as follows:
Ss.main.getRange('C2').setValue(Utilities.formatString(
"%s",
Ss.main.getRange(2,2).getDisplayValue()
));
However, if all you need to do is convert the returned value to a string then you can use the getDisplayValue()
call directly (since the function returns a string by default):
Ss.main.getRange('C2').setValue(Ss.main.getRange(2,2).getDisplayValue());
本文标签: javascriptwhat string literal is available in google apps scriptStack Overflow
版权声明:本文标题:javascript - what string literal is available in google apps script? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742041259a2417557.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论