I have a range of cells selected in a Google Sheets (activerange). I want to iterate over every cell in that range, and add a string to the end. The string is always the same, and can be hard coded into the function.
It seems like a really simple thing, but I've been messing with the code for an hour now and can't get anything useful to happen, and the docs are really not helping.
Here's what I have now. I don't code JS (I do know VBA, for all that helps..).
function appendString() {
var range = SpreadsheetApp.getActiveSheet().getActiveRange();
for (var i = 0; i < range.length; i++) {
var currentValue = range[i].getValue();
var withString = currentValue + " string";
range[i].setValue(withString);
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…