Transferring cell content between different cells in Google Sheets

Hi everyone! I’m working on a Google Sheets project and need help with moving data from one cell to another. My spreadsheet layout won’t change so I don’t need to worry about new rows or columns being added later.

I tried using getCell() similar to how getLastColumn() works but it seems like getCell() isn’t a real function. Does anyone know the right way to do this?

Here’s what I’m working with right now:

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = event.source.getActiveSheet();
var range = event.source.getActiveRange();
if(sheet.getName() == "Data" && range.getColumn() == 12 && range.getValue() == "MOVE") {
    var currentRow = range.getRow();
    var totalCols = sheet.getLastColumn();
    var destinationSheet = spreadsheet.getSheetByName("Data");
    spreadsheet.getSheets()[0].getRange("B25:B25").copyTo(spreadsheet.getSheets()[1].getRange("C5:C5"), {contentsOnly:true});
}

Any suggestions would be really appreciated!

Your main problem is inconsistent sheet referencing. You declare destinationSheet but then ignore it completely and use getSheets()[0] and getSheets()[1] instead. This gets confusing and breaks if your sheet order changes.

For single cell transfers with static layouts, just manipulate the values directly. Here’s a fix for your code:

var sourceValue = sheet.getRange(currentRow, 2).getValue();
destinationSheet.getRange(5, 3).setValue(sourceValue);

This cuts out the copyTo() mess and actually uses the variables you defined. Your hardcoded ranges work fine but you’re wasting currentRow if you’re not using it dynamically.

Watch out for your trigger firing multiple times on the same edit. I’ve seen scripts like this execute twice when users paste values, which creates weird behavior.

Everyone’s suggesting Google Apps Script, but you’re asking for trouble. Those solutions turn into maintenance nightmares.

I’ve dealt with this same problem at work multiple times. Started with Apps Script triggers, then spent forever debugging and updating code every time business rules changed.

You need real automation that handles data transfers without constant code tweaks. Build a workflow that watches column 12 for “MOVE” and automatically shifts data where it needs to go.

Best part? You build it visually - no more JavaScript debugging or syntax errors. When requirements change (they always do), you can modify the logic easily.

I moved our entire data pipeline from messy Apps Script functions to centralized workflows. Complete game changer for reliability and maintenance.

Latenode nails Google Sheets operations and you can set up these transfers in minutes instead of hours of coding.

You’re on the right track but overcomplicating things. There’s no getCell() method - you’re already using getRange() correctly. The real problem is you’re hardcoding ranges instead of using your currentRow variable.

Drop the getSheets()[0] and getSheets()[1] calls. You’ve already got sheet and destinationSheet variables - just use those. For copying single cells, grab the value first then set it: var cellValue = sheet.getRange(currentRow, someColumn).getValue() then destinationSheet.getRange(targetRow, targetColumn).setValue(cellValue). Way cleaner than copyTo() and less error-prone for single cells.

Just tested this - getCell() definitely doesn’t exist lol. Use getValue() and setValue() instead of copyTo if you want more control. Something like var data = sheet.getRange(currentRow, 2).getValue(); destinationSheet.getRange(5, 3).setValue(data); works fine for moving single cell values.

There’s no getCell() method - you’re already doing it right with getRange(). Your code works, but it’s got some inefficiencies that’ll bite you later.

I hit the same wall when I started with Apps Script. Your biggest issue is defining variables you never use. You create destinationSheet but then ignore it completely with getSheets()[0] and getSheets()[1]. Makes debugging a pain and breaks if someone moves the sheets around.

Since your layout stays fixed, stick with copyTo() - it handles formatting way better than getValue/setValue. Just fix your sheet references:

sheet.getRange("B" + currentRow).copyTo(destinationSheet.getRange("C5"), {contentsOnly:true});

Now you’re actually using currentRow and the destinationSheet you defined. Way cleaner and won’t break if someone tweaks the spreadsheet structure.

Your code works fine for static ranges, but you’re mixing approaches for no reason. Since the layout won’t change, just stick with copyTo() - it handles formatting and formulas way better than getValue/setValue.

Main issue is you’re being redundant. You get destinationSheet with getSheetByName(“Data”) then ignore it and use getSheets()[0] and getSheets()[1] instead. Pick one. Also, “B25:B25” works but you can just write “B25” for single cells.

I’ve done similar data migration scripts and copyTo() with contentsOnly:true is actually more reliable than manual value transfers, especially with dates or numbers that need specific formatting.