I want to loop through a set of rows in a Google Spreadsheet that look like this:
XXX 123 234 234
YYY 789 098 765
ZZZ 76 123 345
End Result Needs to Be:
XXX: 123
XXX: 234
XXX: 234
YYY: 789
YYY: 098
etc.
My current code:
function loopshoplocations(){
var sheet = SpreadsheetApp.getActiveSheet();
var data = sheet.getRange('A4:A8').getValues();
var i=0;
for(i = 0; i < 4; i++){
return ('Shop Location: ' + data[i][0]);
}}
Alternatively with a formula
Also see this screenshot:
This code assumes that there is a header row on row one. The data gets appended at the end of the sheet. If you want something different, the code would need to be adjusted.