2 回答

TA贡献1810条经验 获得超4个赞
对于相对更好和可靠的日志记录,请直接使用 Stackdriver(即,查看 > Stackdriver 日志记录),而不是从仪表板中的“执行”页面。为此,您需要通过在 Resources > Cloud Platform project > Change project 中设置自定义项目编号,将Google 云项目从默认切换为标准。
记录对象时,您必须始终
JSON.stringify
在将对象提供给console
.props.toString()
只会返回[object Object]
它的内部结构。
/*<ignore>*/console.config({maximize:true,timeStamps:false,autoScroll:false});/*</ignore>*/
const props = {a:1};
console.log(props.toString());//[object Object]
console.log(JSON.stringify(props));//{"a":1}
<!-- https://meta.stackoverflow.com/a/375985/ --> <script src="https://gh-canon.github.io/stack-snippet-console/console.min.js"></script>

TA贡献1883条经验 获得超3个赞
这似乎工作得很好:
function testprops() {
let sp = PropertiesService.getScriptProperties();
sp.setProperties({'somekey': Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "yyyy:MM:dd HH:mm:ss")});
let props = sp.getProperties();
SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutput(props.somekey), "View Properties");
}
添加回答
举报