Advertisement
Guest User

Untitled

a guest
Apr 6th, 2013
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function acraCleanup() {
  2.   var SPREADSHEET_KEY = "BBBBBV9AAAAAAGJGZVQ0Z2M0WnFDSAFAGACWFUMUE";
  3.  
  4. // Replace with your spreadsheet Key,
  5.  
  6. //you can find this by trying to share the Spread sheet
  7.  
  8. // and getting the key between the "=" and the "&"
  9.   var SHEET_NAME = "Sheet1"; //Sheet1 unless you changed sheet name
  10.   var rowsToKeep = 1000; //Will keep bottom 1000 Rows
  11.   var sheet  = SpreadsheetApp.openById(SPREADSHEET_KEY).getSheetByName(SHEET_NAME);
  12.   var rows = sheet.getLastRow();
  13.   var numToDelete = rows - rowsToKeep - 1;
  14.   if (numToDelete > 0) sheet.deleteRows(2, numToDelete);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement