So I have an meal inventory spreadsheet that is fed by a google form. Employees count meals at the end of the day every night and each 2nd cell of each column has a title: Initial, Monday, Tuesday you get the idea. I'd like to notify myself when certain items are sold at a fast rate so that they can be replenished. My problem is that I can easily get data from the most recent night using
.getLastColumn();
but I want to base each lastColumn data from the most recent column that has "Initial" in the second cell of the column and put them in a 2 column array on a seperate sheet. any ideas? this is my script so far;
function activeData() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var Sheet = ss.getSheetByName("IREmaildata");
var lastCol = Sheet.getLastColumn();
var rangeInitial = Sheet.getDataRange(); // Not sure if this would be correct?
var initial = rangeInitial.getValues();
var int = "Initial"; //the 3rd cell in "Initial" column must say "Initial".
var rangeLastnight = Sheet.getRange(1,lastCol,37,1); //I can easily get the data from the most recent googleForm submission.
var lastNight = rangeLastnight.getValues(); //I can easily get the data from the most recent googleForm submission.
/*
probably some type of logic will go here?
*/
ss.getSheetByName("Sheet5").getRange(1,2,37,1).setValues(yesterday);
ss.getSheetByName("Sheet5").getRange(1,3,37,1).setValues(today);
}