I have what seems to be a very tiny problem...
I have set up a script in Google spreadsheets that returns the current Month & Year and puts it into a cell. (This forms part of a much bigger sheet, so I do need the luxury of executing this within a script). I can't seem to display the previous month, whioch what I want as this is a report for the last month.
So, for example if I want to report on March 2013, how do I get the cell to display this using the current date, or is there a better way to do this?
I am currently doing this but get stuck with the calculation as it error's out "missing ) after argument list on line 9"
function myFunction() {
var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var today_date = Utilities.formatDate(new Date(), "GMT", "MMMM yyyy");
var date = sheet.getRange("A2");
date.setValue(today_date);
date.setFormula("=EDATE("today_date",-1)");
}
Or can I just do it by adding something into the Utilities.formatDate(new Date(), "GMT", "MMMM yyyy");
your help is most appreciated.