I have been looking for a way to copy specific columns and rows of data to an existing sheet. My goal is to create a script that will pull data from the master items sheet and create a ordering form on an existing sheet.
Here's my code
function createOrder() {
var ss = SpreadsheetApp.getActiveSheet();
var ordess = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Ordering");
var mayitems = 186; //number of rows
var descrip = ss.getRange(2, 10, mayitems, 4).getValues(); //first 4 columns to pull
var descrip2 = ss.getRange(2, 19, mayitems).getValues(); //fifth column to pull
var price = ss.getRange(2, 76, mayitems).getValues(); //sixth column to pull
var pallets = ss.getRange(640, 76, 1).getValues(); //specific cell to pull
var targdesc = ordess.getRange(1, 1, mayitems, 4); //first 4 columns to copy to
descrip.copyTo(targdesc); //copying the first 4 columns.
}
I looked at the function reference and copyTo seems to be the one I should be using. I followed the example, but when I run the code, it gave me a TypeError Cannot find function copyTo in object.
I'm also looking to create a script that will filter rows with blank cells like what the filter option can do, but done automatically.
Any help is appreciated.