I have created a function that returns the row indexes which contain the information I am interested in, as below:
[0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0]
I know want to store cell values from certain columns (say Column P row 2) in a list but I cant work out how to use the array above to get values from a cell.
My current code is:
for (var y = 0; y < ListOfContact.length; y++) {
if(ListOfContact[y] == "Wait"){
ListOfRowNumbers.push(y);
}
}
Logger.log(ListOfRowNumbers);
var listOfRelevantCells = [];
for (var yy = 0; yy < ListOfRowNumbers.length; yy++) {
//need to push the cell values to listOfRelevantCells
}
I simply can't find the function to do this but I am sure it is obvious!
I have created a function that returns the row indexes which contain the information I am interested in, as below:
[0.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0]
I know want to store cell values from certain columns (say Column P row 2) in a list but I cant work out how to use the array above to get values from a cell.
My current code is:
for (var y = 0; y < ListOfContact.length; y++) {
if(ListOfContact[y] == "Wait"){
ListOfRowNumbers.push(y);
}
}
Logger.log(ListOfRowNumbers);
var listOfRelevantCells = [];
for (var yy = 0; yy < ListOfRowNumbers.length; yy++) {
//need to push the cell values to listOfRelevantCells
}
I simply can't find the function to do this but I am sure it is obvious!
Share Improve this question asked May 17, 2017 at 11:52 PaulBarrPaulBarr 9496 gold badges22 silver badges36 bronze badges1 Answer
Reset to default 4Try using setValue(value)
:
Sets the value of the range. The value can be numeric, string, boolean or date. If it begins with '=' it is interpreted as a formula.
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];
var cell = sheet.getRange("B2");
cell.setValue(100);
You can use getRange(row, column)
, getRange(row, column, numRows)
or getRange(row, column, numRows, numColumns)
to enter your cellIndexes.
Hope this helps.