ssbot
ssbot copied to clipboard
everyRotate() Loses a Value
When an Every tweet goes out, it removes the first tweet at B3 and moves the list up, but does not rotate the first tweet to the bottom.
function everyRotate(){
var everySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Every");
var lastRow = everySheet.getLastRow();
var nextLastRow = lastRow + 1;
// copy the value of row 3 to the end of the column
var nextValues = everySheet.getRange("b3:z3").getValues();
everySheet.getRange("b"+lastRow+":z"+lastRow).setValues(nextValues);
everySheet.deleteRow(3);
}
Perhaps you meant to do something with nextLastRow?
Perhaps this is more like what you intended. This rotates (rather than slowly nukes) the list.
var everySheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Every");
var lastRow = everySheet.getLastRow();
var nextLastRow = lastRow + 1;
// copy the value of row 3 to the end of the column
var justTweetedValues = everySheet.getRange("b3:z3").getValues();
everySheet.getRange("b"+nextLastRow+":z"+nextLastRow).setValues(justTweetedValues);
// now remove row 3 which will move everything up one
everySheet.deleteRow(3);
}
It appears that the current version works around this by using a next--> pointer that moves instead of actually rotating the values.