Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

everyRotate() Loses a Value #3

Open
wmodes opened this issue May 16, 2017 · 2 comments
Open

everyRotate() Loses a Value #3

wmodes opened this issue May 16, 2017 · 2 comments

Comments

@wmodes
Copy link

wmodes commented May 16, 2017

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?

@wmodes
Copy link
Author

wmodes commented May 16, 2017

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);
}

@antgiant
Copy link
Contributor

antgiant commented Aug 2, 2019

It appears that the current version works around this by using a next--> pointer that moves instead of actually rotating the values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants