I have an array, which is a row of numbers from a sheet. I want to increment each number in the row, however my attempts simply add a value of 1 to the end of the array. Once I've got this sorted I'll need to add the array back onto the sheet, but I haven't got that far yet. I've tried this:
function turnIncrement() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastColumn = ss.getLastColumn()
var turnValuesRow6 = ss.getRange(6, 4, 1, lastColumn);
var turnValues = turnValuesRow6.getValues();
for (var i=0; i < turnValues.length; i++) {
turnValues[i] += 1;}
}
and this
function turnIncrement() {
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var lastColumn = ss.getLastColumn()
var turnValuesRow6 = ss.getRange(6, 4, 1, lastColumn);
var turnValues = turnValuesRow6.getValues();
turnValues.push(turnValues[turnValues.length - 1] + 1);
turnValues.shift();
Both of which just add 1 to the end of the array. I guess I could try and get each value individually, but that seems very inefficient.