say for example i have my table that looks like this
CodePudding user response:
Here is an alternative to @pgSystemTester's answer that uses a for loop.
function getFiltered() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const ws = ss.getActiveSheet();
var theValues = ws.getRange("a:b").getValues();
//Removes the header row
theValues = theValues.slice(1)
var breakfastValues = []
for (let i = 0; i < theValues.length; i ) {
if (theValues[i][0] === "Breakfast") {
breakfastValues.push(theValues[i][1]);
}
}
return breakfastValues
}