Script to remove cells that are timestamped and exceed a timelimit. This is set to one day later. If the timestamp is older than 24 hours the row will be deleted.
function ClearAfter24() {
var ssActive = SpreadsheetApp.getActiveSpreadsheet();
SpreadsheetApp.setActiveSheet(getSheetByName('Sheet1'))
var MyRange = ssActive.getRange("A:A");//selects column A
var ADayAgo = new Date(date.getTime()-(24*3600*1000));
for(i = 0; i < MyRange.length; i++) {
if(MyRange[i].getTime()<ADayAgo){
getActiveSheet().deleteRow(i);
}
}
}
You can extend the days by changing line 5 to:
var ADayAgo = new Date(date.getTime()-7*(24*3600*1000));
This makes the formula check for a week back instead of 24 hours. If you look at this line and this line alone you can see that by changing the 24 to another number it will adjust the hours, the same applies to minutes.