Link to home
Start Free TrialLog in
Avatar of amy Santir
amy Santir

asked on

Linked cells in google sheets

script to copy data from a sheet 1 to sheet 2,3 and so on based on a word on column E of the master list.   not using query, i need to be able to edit data on all sheets
Avatar of abbas abdulla
abbas abdulla
Flag of Bahrain image

Hi amy,

try to amend this code to match your sheets name and desired range, it will work perfectly

function CopyDataFromTo() {
 var sss = SpreadsheetApp.getActiveSpreadsheet();
  var ss = sss.getSheetByName('CopyFrom'); //Change Sheet name to match your sheet name
  

var tss = SpreadsheetApp.getActiveSpreadsheet();
 var ts = tss.getSheetByName('CopyTo'); //Change Sheet name to match your sheet name
  
  var Col_P = ss.getRange('P2:P1000').getValues();  //CopyFromThisDestnation
  ts.getRange('B2:B1000').setValues(Col_P);   //PasteHere
    
  var Col_T = ss.getRange('T2:T1000').getValues();  //CopyFromThisDestnation
  ts.getRange('D2:D1000').setValues(Col_T); //PasteHere
  


  
  
}

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.