My coding issue involves a simple scenario where cell A1 contains a date, for example 06/06/2017.
What I aim to do is add three columns and apply formulas to them. I insert columns using the following code:
ss.insertColumns(1,3);
Subsequently, I set formulas in the three new columns:
ss.getRange(1,1).setFormula('=MONTH(D1);
ss.getRange(1,2).setFormula('=WEEKNUM(D1);
ss.getRange(1,3).setFormula('=CHOOSE(weekday(D1), "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")');
However, I encounter an issue where the new columns inherit the formatting from the original A columns (based on my limited understanding of Google Script). This results in the new A1 cell displaying 05/01/1900. When I choose Format > Number > Number, it displays 6. The number is correct, but the formatting is incorrect.
How can I resolve this problem? It's important to note that the actual file contains hundreds of rows of dates, and I utilize loops to assign the formulas.