admin管理员组文章数量:1356274
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.
本文标签: javascriptGet cell value by row and column number using google scriptStack Overflow
版权声明:本文标题:javascript - Get cell value by row and column number using google script - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744021511a2577289.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论