title: Read cell address and pass to a Range
body: <p>Can anyone help me?</p>
  
  <p>I'm trying to create a range based on 2 vars "cel1" and "cel2" and copy that range to another sheet.</p>
  
  <p>This is the code:</p>
  
  <pre><code>function EXEMPLO() {
    var sheet1 = SpreadsheetApp.openById('1dpp7Ybge8LRb61axkiOolVFFPE6YuVuslOppxz-CU1g').getSheetByName('raw_data');
    var sheet2 = SpreadsheetApp.openById('1dpp7Ybge8LRb61axkiOolVFFPE6YuVuslOppxz-CU1g').getSheetByName('Dados');
    sheet1.getRange('A1').activate();
    do {
      sheet1.getActiveCell().offset(1,0).activate();
    }while (sheet1.getActiveCell().getValue() != 'Data');
    sheet1.getActiveCell().offset(1,0).activate();
    var cel1 = sheet1.getActiveRange(); \\ reading cell 1 address
    sheet1.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate();
    sheet1.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.NEXT).activate();
    var cel2 = sheet1.getActiveRange(); \\ reading cell2 address
    sheet2.getRange('A1').activate(); 
    sheet2.getCurrentCell().getNextDataCell(SpreadsheetApp.Direction.DOWN).activate();
    sheet2.getActiveCell().offset(1,0).activate();
    sheet1.getRange(cel1+":"+cel2).copyTo(sheet2.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_NORMAL, false); \\ try to copy the range to another sheet
  };
  
  </code></pre>