问题
I have a textFinder command wrapped in a for-loop. I believe the issue is with textFinder, but the same error occurs when wrapping the same string I've asked textFinder to find in logger.log(). It runs fine on the first pass, but it returns this error in the second pass.
Exception: You can't perform a paste that partially intersects a merge.
There is no pasting going on here. The cells I'm looking for are merged, but it doesn't take issue with those in the first pass. I'm wondering if it just doesn't know what column to continue looking through, as the values it looks for are all in merged cells. Is there any way to work around this without unmerging the cells? I'm only trying to look at each row once.
var ePos = eBoard.getCell(2, 1); // change 2 to match eRow start value
// Initialize textFinder
var findBlank = Editor.getRange(row1,col1,100).createTextFinder('**LEAVE THIS ROW BLANK**');
var findMe = Editor.createTextFinder(ePos.getDisplayValue()).startFrom(eBoard.getCell(1,1));
for (var eRow = 2; eRow <= (row2-row1); eRow++){
ePos = eBoard.getCell(eRow, 1);
Logger.log(ePos.getDisplayValue()) //<--- error HERE
// get the next range of members
var topHold = findMe.findNext().getRow() + 1; // <--- error HERE
var botHold = findBlank.findNext().getRow() - 1; // <--- error HERE
var directors = Editor.getRange(topHold,1,(botHold - topHold + 1),3);
}
来源:https://stackoverflow.com/questions/61741881/how-can-i-fix-this-exception-when-working-with-text-finder-and-merged-cells-in-a