I'm using Sheet.CopyTo to copy a range of cells from one sheet to another and I'm getting the error "Your paste overlaps with merged cells. Please unmerge the cells and try again.". The range I'm pasting contains merged cells but the range I'm pasting to is on a totally blank sheet with no merges. In other cases where the source range has merged cells copyTo works fine. Doing the same paste from the UI works fine.
Here is my code:
function test()
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var src = ss.getSheetByName('Src');
var srcRange = src.getRange('F2:W2');
var dst = ss.getSheetByName('Dst');
var dstRange = dst.getRange('F2');
srcRange.copyTo(dstRange);
}
Public version of the spreadsheet is at:
https://docs.google.com/spreadsheet/ccc?key=0AmjukMc-vZIEdEtyYk53VlpWMEV3Y0l5THQ1OFBJSUE