Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. function myFunction() {
  2. var SHEETNUMBER = 1
  3. var ss = SpreadsheetApp.openById("1UJtHMg58-SybeqwMPVD6eKG6cWPuePIYTCd7uJfigTU");
  4. var values = ss.getSheetValues(1, 20, 50, 5);
  5. var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  6. var newss = SpreadsheetApp.setActiveSheet(sheets[SHEETNUMBER-1]);
  7. newss.deleteRows(1, 100)
  8. for (var j=7; j < values.length; j++) {
  9. newss.appendRow(values[j]);
  10. }
  11. var endRow = SpreadsheetApp.getActiveSheet().getLastRow();
  12. var range = newss.getDataRange();
  13.  
  14. for (var i = 1; i < range.getLastRow() + 1; i++){
  15. var status = newss.getRange(i, 2).getValue();
  16. var rowRange = newss.getRange(i, 1, 1, 5);
  17. if (status == 'Shaman') {
  18. rowRange.setBackgroundColor("#0070DE");
  19. } else if (status == 'Warrior') {
  20. rowRange.setBackgroundColor("#C79C6E");
  21. } else if (status == 'Paladin') {
  22. rowRange.setBackgroundColor("#F58CBA");
  23. } else if (status == 'Hunter') {
  24. rowRange.setBackgroundColor("#ABD473");
  25. } else if (status == 'Rogue') {
  26. rowRange.setBackgroundColor("#FFF569");
  27. } else if (status == 'Priest') {
  28. rowRange.setBackgroundColor("#FFFFFF");
  29. } else if (status == 'Death Knight') {
  30. rowRange.setBackgroundColor("#C41F3B");
  31. } else if (status == 'Mage') {
  32. rowRange.setBackgroundColor("#69CCF0");
  33. } else if (status == 'Warlock') {
  34. rowRange.setBackgroundColor("#9482C9");
  35. } else if (status == 'Monk') {
  36. rowRange.setBackgroundColor("#00FF96");
  37. } else if (status == 'Druid') {
  38. rowRange.setBackgroundColor("#FF7D0A");
  39. } else if (status == '') {
  40. rowRange.setBackgroundColor("#FFFFFF");
  41.  
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement