a really quick question... I want to read rows in sheets one by one, (preferably 'live' so rather than putting it in an array or something). Besides using a loop, how do I read the contents of a whole row? Is it even possible?
You can read about it here
function readData() {
var sht = SpreadsheetApp.getActiveSheet();
var rng = sht.getRange(rownumber, 1, 1, numberofcolums)
var rangeArray = rng.getValues();
//now all your data for that row is in a two Dimensional array [[1,2,3,4,'My Data','etc']]
}
var
spreadsheetID =
"1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms",
rowNum = 1,
rowVals =
SpreadsheetApp.openById(spreadsheetID)
.getRange(rowNum +":"+ rowNum)
.getValues()
;
The other answers to date don't get a row, they get a range of specfic columns within a row. The code in this answer gets the entire unbounded row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With