我发现在线Google驱动器脚本发送了一封电子邮件,其中包含我所插入的亚马逊产品价格的变化。
This is the file
我无法使其适用于100%。.有时它仅适用于某些产品,我找不到原因。
请帮助我了解问题所在。
另外,我想知道是否可以修改脚本,以便它每天两次向我发送警报,而不仅仅是现在。
最佳答案
配置电子邮件通知间隔
电子邮件通知被配置为Google Apps脚本触发器调用priceEmail
功能。在初始化电子表格时,它们是随机分配的(请参阅Start_Tracking
实现)。
手动配置电子邮件通知-例如添加第二封每日电子邮件-打开与电子表格关联的Copy of Amazon Price Tracker by ctrlq.org
脚本(通过电子表格工具>脚本编辑器...菜单命令)。然后继续打开触发器对话框(资源>当前项目的触发器菜单命令),并为priceEmail
挂钩添加新的时间驱动触发器。
脚本错误
默认情况下,priceEmail
函数以静默方式处理所有错误。没有什么线索可以导致脚本在100%的时间内无法正常工作。如果您希望收到有关错误的通知,请删除当前实现中的异常处理或更新priceEmail
正文。
我建议进行以下修改(同样通过电子表格的工具>脚本编辑器...菜单命令):
function priceEmail() {
var sheet, data, page, table="";
sheet = SpreadsheetApp.getActiveSheet();
data = sheet.getRange(2, 2, 21, 2).getValues(); // Note that the script will only look at the first 20 rows.
try {
for (i in data) {
if (data[i][0] !== "") {
page = UrlFetchApp.fetch(
"http://ctrlq.org/aws/lookup/", {
"method": "post", "payload": {"url":data[i][0]}
}).getContentText();
table = table + tableRow(page);
}
}
} catch (e) {
Logger.log(e.toString());
// Following line inserted to include any error messages in your daily email(s).
table += "<tr><td><strong>Error:</strong></td><td>" + e + " (url: \"" + data[i][0] + "\")</td></tr>";
}
// ...
关于java - Google云端硬盘脚本不起作用,,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23446147/