K
K
kikuuu2020-10-21 10:33:27
Google Apps Script
kikuuu, 2020-10-21 10:33:27

Google script, transferring data from one sheet to another?

There are two codes:
The first one inserts info on the right

function addtodescriptionright(){
  var ss1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Генер");
  var ss2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Лист14");
  var values = ss1.getRange(1, 1, 14, 1).getValues();
  Logger.log(values);
  
  var r = ss2.getLastRow();
  var r1 = ss2.getLastColumn();
  
  var values = ss2.getRange(5, r1+2, 14, 1).setValues(values);
  
  
  
}

Second from the bottom.
function addtodescriptionbottom(){
  var ss1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Генер");
  var ss2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Лист14");
  var values = ss1.getRange(1, 1, 14, 1).getValues();
  Logger.log(values);
  
  var r = ss2.getLastRow();
  var r1 = ss2.getLastColumn();
  
  var values = ss2.getRange(r+5, 3, 14, 1).setValues(values);
  
  
  
}

How to combine them and make it so that, after 5 inserts down, he inserts 1 time to the right and in the same column 4 more times to the bottom, and so on ad infinitum.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question