I'm working in a Google sheet where I have several custom functions that geocode an address into lat/long details. But I want to copy this value into another column on the same sheet as a value so the end result remain static. I found a working piece of code that does this for an entire range but I can't get it dynamic so I can let it work for a single row and use the function per row where I need it.
Below is the code I have already.
So when I go to cell N2
and call =getRangeValues()
, it will copy the values for all fields from M2
until M9
into N2:N9
but that's not what I want. I want it to only copy it for M2
into N2
for a single row.
I tried replacing the getRange
into ActiveCell but that doesn't to the trick.
Anybody who can help me out with this?
function getRangeValues() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("M2:M9");
var values = range.getValues();
return values;
};
M2
andN2
or are you asking for a general solution to copy a value from one column to the neighboring column to the right for any given row? – dwmorrin