receiveing Service error: Spreadsheets
receiveing Service error: Spreadsheets
请检查以下错误信息。
11/2/17 8:40 AM refreshStatus 服务错误:电子表格(第 8 行,文件 "Code")基于时间 11/2/17 8:41 AM。
我每天都会收到这个错误邮件。
能否请教一下。
我的代码在下面,请您查看并提出建议。
function refreshStatus()
{
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var statusCol=6;
for(i=2;i<=lastRow;i++)
{
var value = sheet.getRange(i, statusCol).getValue();
//Logger.log(value);
if(value == "Checked")
{
sheet.getRange(i, statusCol).setBackground('Green');
sheet.getRange(i, statusCol).setFontColor('White');
}
else
{
sheet.getRange(i, statusCol).setBackground('Red');
sheet.getRange(i, statusCol).setFontColor('White');
}
}
}
function mailer()
{
//Logger.log(e);
var sheet= SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var value = sheet.getRange(lastRow, 10).getValue();
// 10th column contains the unique code
//Logger.log(value);
var values = sheet.getRange(lastRow, 3).getValue();
var values3 = sheet.getRange(lastRow, 4).getValue();
var values2 = sheet.getRange(lastRow, 1).getValue();
var values4 = sheet.getRange(lastRow, 5).getValue();
var values1 = sheet.getRange(lastRow, 2).getValue();
var formUrl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+value;
//Logger.log(formUrl);
MailApp.sendEmail({
to: values,
subject: "New Handover - "+values3+"",
htmlBody: "<b>"+
values3 +"</b> handovered to you.<p>By: "+
values1 + "<p>Time: "+
values2 + "<p>Description: "+
values4 + '<p><form method="post" action="'+formUrl+'"><input type="submit" value="Checked"></form>'});
sheet.getRange(lastRow,13).setValue('EMAIL_SENT');
}
function backupMail()
{
var sheet = SpreadsheetApp.getActiveSheet();
var values=SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for(i=3; i<values.length; i++)
{
if(values[i][12] == "")
{
var formUrl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+values[i][9];
MailApp.sendEmail({
to: values[i][2],
subject: "New Handover(b) - "+values[i][0]+"",
htmlBody: "<b>"+
values[i][3] +"</b> handovered to you.<p>By: "+
values[i][1] + "<p>Time: "+
values[i][0] + "<p>Description: "+
values[i][4] + '<p><form method="post" action="'+formUrl+'"><input type="submit" value="Checked"></form>'})
var a=i+1;
sheet.getRange(a,13).setValue('EMAIL_SENT(b)');
}
else
{
Logger.log("ELSE");
}
}}
function pendingstatus()
{
var ss =SpreadsheetApp.getActiveSheet();
var values=SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for (i=3; i<values.length; i++)
{
if (values[i][5] == "Pending")
{
var formurl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+values[i][9];
MailApp.sendEmail({
to: values[i][2],
subject: "Pending Handover - "+values[i][3]+"",
htmlBody: "<b>"+
values[i][3] +"</b> was handovered to you.<p>By: "+
values[i][1] + "<p> on: "+values[i][0] +" "+
"<p>With Description: "+
values[i][4] + '<p>Please mark handover as checked as it is pending.' + '<p><form method="post" action="'+formurl+'"><input type="submit" value="Checked"></form>'})
var a=i+1;
ss.getRange(a,7).setValue('Reminder_Sent');
}
else
{
Logger.log("ELSE");
}
}
}
function maxExc() {
var startTime= (new Date()).getTime();
//do some work here
var scriptProperties = PropertiesService.getScriptProperties();
var startRow= scriptProperties.getProperty('start_row');
for(var ii = startRow; ii <= size; ii++) {
var currTime = (new Date()).getTime();
if(currTime - startTime >= MAX_RUNNING_TIME) {
scriptProperties.setProperty("start_row", ii);
ScriptApp.newTrigger("maxExc")
.timeBased()
.at(new Date(currTime+REASONABLE_TIME_TO_WAIT))
.create();
break;
} else {
doSomeWork();
}
}
//doSomeWork(); executes relatively quick less than 1 minute.
}
如果需要进行任何更改以避免错误,请告知我们。
提前感谢您的及时回复。
我每天晚上都会遇到这些错误。我写了很多 GSuite 脚本,我的收件箱被它们塞满了垃圾邮件。忽略它:)
除非脚本不起作用..
请检查以下错误信息。
11/2/17 8:40 AM refreshStatus 服务错误:电子表格(第 8 行,文件 "Code")基于时间 11/2/17 8:41 AM。
我每天都会收到这个错误邮件。
能否请教一下。
我的代码在下面,请您查看并提出建议。
function refreshStatus()
{
var sheet = SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var statusCol=6;
for(i=2;i<=lastRow;i++)
{
var value = sheet.getRange(i, statusCol).getValue();
//Logger.log(value);
if(value == "Checked")
{
sheet.getRange(i, statusCol).setBackground('Green');
sheet.getRange(i, statusCol).setFontColor('White');
}
else
{
sheet.getRange(i, statusCol).setBackground('Red');
sheet.getRange(i, statusCol).setFontColor('White');
}
}
}
function mailer()
{
//Logger.log(e);
var sheet= SpreadsheetApp.getActiveSheet();
var lastRow = sheet.getLastRow();
var value = sheet.getRange(lastRow, 10).getValue();
// 10th column contains the unique code
//Logger.log(value);
var values = sheet.getRange(lastRow, 3).getValue();
var values3 = sheet.getRange(lastRow, 4).getValue();
var values2 = sheet.getRange(lastRow, 1).getValue();
var values4 = sheet.getRange(lastRow, 5).getValue();
var values1 = sheet.getRange(lastRow, 2).getValue();
var formUrl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+value;
//Logger.log(formUrl);
MailApp.sendEmail({
to: values,
subject: "New Handover - "+values3+"",
htmlBody: "<b>"+
values3 +"</b> handovered to you.<p>By: "+
values1 + "<p>Time: "+
values2 + "<p>Description: "+
values4 + '<p><form method="post" action="'+formUrl+'"><input type="submit" value="Checked"></form>'});
sheet.getRange(lastRow,13).setValue('EMAIL_SENT');
}
function backupMail()
{
var sheet = SpreadsheetApp.getActiveSheet();
var values=SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for(i=3; i<values.length; i++)
{
if(values[i][12] == "")
{
var formUrl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+values[i][9];
MailApp.sendEmail({
to: values[i][2],
subject: "New Handover(b) - "+values[i][0]+"",
htmlBody: "<b>"+
values[i][3] +"</b> handovered to you.<p>By: "+
values[i][1] + "<p>Time: "+
values[i][0] + "<p>Description: "+
values[i][4] + '<p><form method="post" action="'+formUrl+'"><input type="submit" value="Checked"></form>'})
var a=i+1;
sheet.getRange(a,13).setValue('EMAIL_SENT(b)');
}
else
{
Logger.log("ELSE");
}
}}
function pendingstatus()
{
var ss =SpreadsheetApp.getActiveSheet();
var values=SpreadsheetApp.getActiveSheet().getDataRange().getValues();
for (i=3; i<values.length; i++)
{
if (values[i][5] == "Pending")
{
var formurl="https://script.google.com/a/macros/lafargeholcim.com/s/AKfycbx8V31uCLtAAZWV4ictEvJyM6WIRDYz3tm6LOPlMNxy38VJSgs/exec?pkey="+values[i][9];
MailApp.sendEmail({
to: values[i][2],
subject: "Pending Handover - "+values[i][3]+"",
htmlBody: "<b>"+
values[i][3] +"</b> was handovered to you.<p>By: "+
values[i][1] + "<p> on: "+values[i][0] +" "+
"<p>With Description: "+
values[i][4] + '<p>Please mark handover as checked as it is pending.' + '<p><form method="post" action="'+formurl+'"><input type="submit" value="Checked"></form>'})
var a=i+1;
ss.getRange(a,7).setValue('Reminder_Sent');
}
else
{
Logger.log("ELSE");
}
}
}
function maxExc() {
var startTime= (new Date()).getTime();
//do some work here
var scriptProperties = PropertiesService.getScriptProperties();
var startRow= scriptProperties.getProperty('start_row');
for(var ii = startRow; ii <= size; ii++) {
var currTime = (new Date()).getTime();
if(currTime - startTime >= MAX_RUNNING_TIME) {
scriptProperties.setProperty("start_row", ii);
ScriptApp.newTrigger("maxExc")
.timeBased()
.at(new Date(currTime+REASONABLE_TIME_TO_WAIT))
.create();
break;
} else {
doSomeWork();
}
}
//doSomeWork(); executes relatively quick less than 1 minute.
}
如果需要进行任何更改以避免错误,请告知我们。
提前感谢您的及时回复。
我每天晚上都会遇到这些错误。我写了很多 GSuite 脚本,我的收件箱被它们塞满了垃圾邮件。忽略它:)
除非脚本不起作用..