How would I write a script that increments the selected cells. Here is code for incrementing one selected cell. Cells will always contain natural numbers.
function increment() {
var currentCell = SpreadsheetApp.getCurrentCell();
var value = currentCell.getValue();
currentCell.setValue(value+1);
}
I want something like this if possible
function increment(){
var selectedCells = SpreadsheetApp.getSelectedCells();
selectedCells.forEach( (e) => {
e.setValue(e.getValue() + 1 );
});
}