'Need help creating a script that automatically inputs the month and day to google sheets using Apps Script

I'm having issues creating a script that will automatically input the Month on the first row and then the days of the month on the second row, for a full month or a full year.

Something that will look like this - https://i.stack.imgur.com/R7vnf.png



Solution 1:[1]

You do nit need a script

A1 : 2022

A2 : =arrayformula(if(day(A3:3)=1,A3:3,))

A3 : =(sequence(1,date(A1,12,31)-date(A1-1,12,31),date(A1,1,1),1))

then put format on rows 2 and 3 as needed

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Steelson