I have a requirement where I need to take values from one column (or more) and copy them to another sheet in the next available column (s). I have written a script like this
The entire 4th column & 17th row onward can be appended as a column into a different sheet with this approach also.
var sheetfrom = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetfrom');
var sheetto = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('sheetto');
sheetfrom.getRange(17, 4, sheetfrom.getLastRow(), 1).copyTo(sheetto.getRange(1,
sheetTo.getLastColumn()+1, sheetfrom.getLastRow()-17, 1), {
contentsOnly: true
});
This also overcomes the empty cell problem of copying data from some Formula outputs.