diff --git a/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java b/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java index e35cfc87e..c45e8782c 100644 --- a/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java +++ b/main/src/com/google/refine/operations/cell/TransposeColumnsIntoRowsOperation.java @@ -339,12 +339,17 @@ public class TransposeColumnsIntoRowsOperation extends AbstractOperation { for (int r2 = firstNewRowIndex + 1; r2 < newRows.size(); r2++) { Row newRow = newRows.get(r2); for (int c = 0; c < newColumns.size(); c++) { - Column column = newColumns.get(c); - int cellIndex = column.getCellIndex(); - - Cell cellToCopy = firstNewRow.getCell(cellIndex); - if (cellToCopy != null && newRow.getCell(cellIndex) == null) { - newRow.setCell(cellIndex, cellToCopy); + if (c < startColumnIndex || + (_combinedColumnName != null ? + c > startColumnIndex : + c > startColumnIndex + 1)) { + Column column = newColumns.get(c); + int cellIndex = column.getCellIndex(); + + Cell cellToCopy = firstNewRow.getCell(cellIndex); + if (cellToCopy != null && newRow.getCell(cellIndex) == null) { + newRow.setCell(cellIndex, cellToCopy); + } } } }