作为免责声明,我对编程概念颇为陌生。如果你真的想成为我最好的朋友,那么解释越具体越好。但任何帮助表示赞赏。使用脚本应用从Google表格中的单元格拉取日期
我的小型企业使用QuickBooks进行工资计时,但出于后勤目的,我们的员工使用谷歌电子表格输入他们的时间。
我想写一个脚本,每天检查第一列的日期两次(按照我设置的触发器)。如果日期等于或大于今天的日期,我需要脚本检查同一行中几列的单元格以查看单元格是否已被填写。如果它是0或null,我想发送一个通知。
请参阅下图以供参考。
到目前为止,这是我所:
function values2()
{
var ss = SpreadsheetApp.getActiveSpreadsheet(),
sheet = ss.getSheetByName("TimeSheet"),
range = sheet.getDataRange(),
values = range.getValues(),
indx, logToday, today, body,
recipients = "[email protected]",
subject = "Timesheet Notification" + ss.getName();
//Finds current date and creates string. I would prefer to have a numeric value associated to the current date, as well as a numeric value associated with the date for 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 to my email for test purposes
MailApp.sendEmail(recipients, subject, today);
//Clears Log
Logger.clear();
for (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);
}
在这一点上,我希望能够赶上从第一列每个日期,将其比作今天的日期,支票另一个单元格放在同一行中,然后移至第一列中的下一个日期。我已经玩过IF/Else的声明,但无济于事。
向我们展示您的尝试和出错 –