Google Apps 脚本 - 循环日期

何塞·里卡多

在我的谷歌表中,我有三个单元格:

A1 => with the Year ex: 2018
A2 => with the Month ex: 08
A3 => with the number of total months to loop ex: 12

My goal is to save in the same sheet the 12 sequential dates with End of Month:
ex: 31.08.2018 // 30.09.2018 // etc.

How to solve this?
idfurw

公式:

=ArrayFormula(EOMONTH(A1&"/"&A2,SEQUENCE(A3,1,0,1)))

Google Apps 脚本:

//const [y, m, c] = sheet.getRange('A1:A3').getValues().flat();
const y = 2018;
const m = 08;
const c = 12;

const values = [...Array(c).keys()].map(n=>[new Date(y, m + n, 0)]);
console.log(values);
// sheet.getRange(4, 8, values.length, values[0].length).setValues(values);

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章