javascript - Pulling Date From Cell in Google Sheet Using Script App -


as disclaimer, rather new programming concepts. if wanted best friend, more specific explanation better. appreciated.

my small tiny business uses quickbooks our payroll timekeeping, logistical purposes, have our employees use google spreadsheet enter in times.

i want write script checks first column date twice day (as per trigger have set up). if date equal or greater today's date, need script check cell few columns down in same row see if cell has been filled out. if 0 or null, want send notification.

please see picture below reference.

test

so far, have:

function values2()  {     var ss = spreadsheetapp.getactivespreadsheet(),       sheet = ss.getsheetbyname("timesheet"),       range = sheet.getdatarange(),       values = range.getvalues(),       indx, logtoday, today, body,       recipients = "xxxxx@xxx.zzz",       subject = "timesheet notification" + ss.getname();  //finds current date , creates string. prefer have numeric value associated current date, numeric value associated date each row.   var currentdate = new date();   logger.log(currentdate);       logtoday = logger.getlog();       indx = logtoday.indexof("info");       today = logtoday.substring(indx + 6, indx + 16);  //i'm having things sent email test purposes   mailapp.sendemail(recipients, subject, today);   //clears log   logger.clear();   (var r=1; r<values.length; r++)    {   var row = values[r],       date = row[0],       price = row[1],       units = row[2],       total = row[3],       name = row[4];     logger.log(date);      logger.log(price);    logger.log(units),    logger.log(total),    logger.log(name);   }    body = logger.getlog();   mailapp.sendemail(recipients, subject, body); } 

at point, want able catch each date first column, compare today's date, check cell in same row, move on next date in first column. i've played around if/else statments, no avail.

if want compare date elements of first column included empty cells today, how following script?

function values2()  {     var ss = spreadsheetapp.getactivespreadsheet(),       sheet = ss.getsheetbyname("timesheet"),       range = sheet.getdatarange(),       values = range.getvalues(),       indx, logtoday, today, body,       recipients = "xxxxx@xxx.zzz",       subject = "timesheet notification" + ss.getname();      var lr = sheet.getlastrow();     var dateinfo = sheet.getrange('a1').offset(0, 0, lr, 1).getvalues();     var today = new date();     var y0 = today.getfullyear();     var m0 = today.getmonth() + 1;     var d0 = today.getdate();      (var i=0; i<dateinfo.length; i++){         x = date.parse(dateinfo[i]);         var date = new date(x);         var y = date.getfullyear();         var m = date.getmonth() + 1;         var d = date.getdate();         if (y0 === y && m0 === m && d0 === d) {             logger.log("ok:" + i) // same date         } else {             logger.log("error:" + i)  // difference date         };     }; } 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -