SHARE
TWEET

Untitled

a guest Sep 13th, 2017 41 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Year | Month
  2. 2012 | 12
  3. 2013 | 01
  4. 2013 | 02
  5. 2013 | 03
  6.    
  7. Year | Month
  8. 2012 | 12
  9. 2013 | 01
  10. 2013 | 02
  11. 2013 | 03
  12. 2012 | 12
  13. 2013 | 01
  14. 2013 | 02
  15. 2013 | 03
  16. 2012 | 12
  17. 2013 | 01
  18. 2013 | 02
  19. 2013 | 03
  20.    
  21. function output(range,amount,header) {
  22.   var output = [];
  23.  
  24.   // check if range is cell
  25.   if(typeof range == 'string') {
  26.     for(var i=0; i<amount; i++) {
  27.       output.push([range]);
  28.     }
  29.     return output;
  30.   } else {
  31.     // check if header is wanted
  32.     var value;
  33.     if(header == 1) {
  34.       output.push(range[0]);
  35.       value=header;
  36.     } else if(header == "") {
  37.       value=0;
  38.     } else {
  39.       value=0;
  40.     }  
  41.     for(var i=0; i<amount; i++) {
  42.       for(var j=value, jLen=range.length; j<jLen; j++) {
  43.         output.push(range[j]);
  44.       }
  45.     }    
  46.     return output;
  47.   }  
  48. }
RAW Paste Data
Top