且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法返回数组[Google apps脚本]

更新时间:2023-12-05 10:23:16

不幸的是,已记录的google.script.run限制之一(自2019年3月起仍然有效)是,您不能在任何方式,包括作为数组的一部分.

Unfortunately, one of the documented limitations of google.script.run (still valid as of March 2019) is that you can't pass a Date object in any way, including as part of an array.

您可以在某个范围内调用getDisplayValues()而不是getValues()来仅获取一个以字符串开头的数组,也可以通过处理getValues()数组将Date对象转换为String.

You can either call getDisplayValues() instead of getValues() on a range to only fetch an array of Strings to begin with, or you can convert Date objects to Strings by processing the getValues() array.