Here's the script:
function deletesheet(){
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
var date0 = new Date(new Date().getTime() - 2 * MILLIS_PER_DAY)
var dateM = Utilities.formatDate(date0, "GMT 1", "MM");
var dateD = Utilities.formatDate(date0, "GMT 1", "dd");
var date2 = dateD dateM;
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getSheetByName(String(date2))
Logger.log("The problem isint here")
if(sheet.getRange(sheet.getMaxRows(),sheet.getMaxColumns()).isChecked()){
Logger.log("True")
}else{
Logger.log("FAlsse")
}
It doesn't even log "The problem isnt here".
CodePudding user response:
We can only fix the typos / syntax errors as follows, adding the proper delimiters such as closing brackets and semicolons where applicable.
From the comments it is suggested to use the Apps Script IDE as an indicator of where do you have missing brackets/parenthesis, etc...
function deletesheet(){
var MILLIS_PER_DAY = 1000 * 60 * 60 * 24;
var date0 = new Date(new Date().getTime() - 2 * MILLIS_PER_DAY);
var dateM = Utilities.formatDate(date0, "GMT 1", "MM");
var dateD = Utilities.formatDate(date0, "GMT 1", "dd");
var date2 = dateD dateM;
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getSheetByName(String(date2));
Logger.log("The problem isint here");
if(sheet.getRange(sheet.getMaxRows(),sheet.getMaxColumns()).isChecked()){
Logger.log("True");
} else {
Logger.log("FAlsse");
}
}
CodePudding user response:
This works:
function lookingforcheckboxes(){
const ss = SpreadsheetApp.getActive();
const dt = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()- 2);
const sh = ss.getSheetByName(Utilities.formatDate(dt, "GMT 1", "ddMM"))
if(sh.getDataRange().isChecked()){
Logger.log("True")
}else{
Logger.log("FAlsse")
}
}