In Google Sheets, when I store a given a1notation into an appendRow, I want the values from this appended Row to be shown on another sheet while retaining the grid structure it had when it was saved intitially.
So from the below code, the data from the appendedRow(11,5,1,5) shall be set to the grid I5:J7.
Sadly I am not proficient enough to work with for
loops and push()
/ array, so I would appreciate your support greatly.
Thank you.
function Test() {
var rs = SpreadsheetApp.getActiveSpreadsheet();
var ss = rs.getSheetByName("Sheet");
var tempArray = [ss.getRange(11,5,1,5)]
var values = tempArray.getValues();
ss.getRange('I5:J7').setValues(values);
}
ss.getRange(11,5,1,5)
gives you a 1x5 grid, but your destination range ('I5:J7') is giving you a 2x3 grid. - Aung49appendRow()
, also yourtempArray
is pointless becausegetValues()
returns an array anyway. - ross