I have a range of data on sheet5 which needs to be copied and inserted 27 columns in from the end of sheet1. I can get it to insert the column in the right place but it doesn't copy the data. I am new to scripting so any advice would be of great help.
Here is code I am using:
function store() {
var ss = SpreadsheetApp.getActiveSpreadsheet ();
var source = ss.getRange ("Sheet5!D4:D80");
var destSheet = ss.getSheetByName("Sheet1");
var lastCol = destSheet.getLastColumn() -27;
destSheet.insertColumnAfter(lastCol);
source.copyTo(destSheet.getRange(lastCol + 1,1), {contentsOnly: true});
SpreadsheetApp.getUi().alert('Played today Recorded');
}