I have a spreadsheet with some information on, and I want it to copy across to a second sheet automatically. I also want it to copy across automatically when I insert new rows within the rows copied across. I found the code below but I don't completely understand what I would have to do to it for it to do what I want, or if I would need to add anything. I have basic coding knowledge but not much, so if someone could explain this it would be much appreciated.
function myFunction() {
var source = SpreadsheetApp.openById('xxxxxx');
var sourcesheet = source.getSheetByName('sheet1');
var target = SpreadsheetApp.openById('xxxxx')
var targetsheet = target.getSheetByName('sheet1');
var rangeValues = sourcesheet.getRange(2, 1, sourcesheet.getLastRow(), sourcesheet.getLastColumn()).getValues();
targetSheet.appendRow(rangeValues);
}