I am attempting to copy the contents of an array from one sheet (where the array is created by iterating through and pushing select items for the column of the user’s choosing) to a different sheet in a different spreadsheet.
I have come across a number of questions and answers on how to import a range from one spreadsheet to another, but none of them has worked for me (all returning the error “We’re sorry, a server error occurred. Please wait a bit and try again.”) I’ve tried ‘copyTo’ as well, with no success.
Here is the code I’m using currently. Where have I gone wrong??
function copyToTrix(featureList) {
featureList = featureList.getValues();
var tss = SpreadsheetApp.openById("0AtX9IYFZ..."); //define active trix as target
var ts = tss.getSheetByName("US"); //define sheet in target trix
var newRange = ts.getRange("DA12:DA25"); //define target range
newRange.setValues(featureList); //set values in target range to items in featureList
Browser.msgBox('copied');
}
It turns out the GAS is having trouble with the setValues() function. It wasn’t working to take a full range, so I ended up having to use setValue() instead. (Set value only allows you to operate in one cell at a time):