Google-sheets – Script to copy range transposed to another sheet

google sheetsgoogle-apps-script

I need to copy a range from the sheet 'Source' to the sheet 'Database' but transposed. It should be the range B1:T9, not the whole sheet. I need to do it with a script as it is going to be a database collected from many reports.

Here is the link
Example sheet

Any ideas how to do it as I didn't find workable code examples for this case

Best Answer

I've solved the issue with the simple copyTo. Didn't know that is can has the syntaxis copyTo(destination, copyPasteType, transposed)

Google example

var sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange("A:E").copyTo(sheet.getRange("F1"), spreadsheetApp.CopyPasteType.PASTE_VALUES,true);