S
S
Sega6662019-04-27 14:52:27
Google Sheets
Sega666, 2019-04-27 14:52:27

How to multiply the date from sheet 1 A3 to sheet 2 A3, Sheet 1 A4 to sheet 2 A9 step 5 lines?

How to multiply a date from sheet 1 A3 to sheet 2 A3, Sheet 1 A4 to sheet 2 A9 step 5 lines
On sheet 1, the dates go in a column, in order, and on sheet 2 this date will have several values, that is, the next number taken from lit 1 will be in 5 lines
Sheet 1 A4 to sheet 2 A9 step 5 lines
Sheet 1 A5 to sheet 2 A14 step 5 lines and so on
By simple dragging, replaces the value with step +1
With substitution $ static values

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2019-04-29
@Sega666

function myFunction() {
  var sheet_1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('1'); //название листа откуда берем данные
  var sheet_2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('2'); //название листа куда вставлялем данные
  var s1vals = sheet_1.getRange("A1:A").getValues(); //откуда забираем данные. Поменять на свой диапазон
  var arr = [];
  for(var i=0;i<s1vals.length;i++){
    for(var j=1;j<6;j++){
      var a = []
      if(j % 5 == 0){
        a.push(s1vals[i]);
      }else{
        a.push('');
      }
      arr.push(a);
    }
  }
  sheet_2.getRange(1, 1,arr.length,1).setValues(arr); //куда вставляем данные в формате. Поменять первые два значения на свой диапазон в формате "ряд", "колонка" 
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question