Problem to get value from a range dynamically and set this value to other range of another sheet

29 Views Asked by At

Actually i have two sheet one is master sheet and other is data sheet. i want to input data in every 5th row and starting with 4th row(i.e 4, 9, 14, ...etc) in the Master sheet("1EzemDPlSwWo5SJsJkePbPUlrOh-BoCa9svu9i85uZfQ"). Now i want these data to Data sheet("1hdbT-g2gDdLVng6jMieOULgjWlPlRckl8sUS_UGJroQ") in every 5th row starting with 7th row.

function myFunction() {
var An = SpreadsheetApp.openById("1EzemDPlSwWo5SJsJkePbPUlrOh-BoCa9svu9i85uZfQ");
 var GetSa1 =An.getSheetByName("CLASS I  FORMATIVE(A.N)");
var Fs = SpreadsheetApp.openById("1hdbT-g2gDdLVng6jMieOULgjWlPlRckl8sUS_UGJroQ");
 var GetFh1 =Fs.getSheetByName("REPORT CARD FOR ALL CLASS 2023");
 
 var Ps1 =[];
for(var i = 4;i<=44;i=i+5){
  Ps1=(GetSa1.getRange("O"+[i]).getValue());
Logger.log( Ps1);
for(var j=7;j<=44;j=j+5){ 
 GetFh1.getRange("R"+[j]).setValue(Ps1);

      }
    }
}
0

There are 0 best solutions below