if you use simply :
var values = SpreadsheetApp.getActiveSheet().getDataRange().getValues()
You will get a 2 Dimension array of all the data in the sheet indexed by rows and columns.
So to get the value in column A, row1 you use values[0][0]
, values[1][0]
for columnA, row 2, values[0][2]
for column C row1, etc...
If you need to iterate in a for loop (in a single column) :
for(n=0;n<values.length;++n){
var cell = values[n][x] ; // x is the index of the column starting from 0
}
If you need to iterate in a for loop (in a single row) :
for(n=0;n<values[0].length;++n){
var cell = values[x][n] ; // x is the index of the row starting from 0
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…