[英]Google Apps Script : The parameters (String) don't match the method signature for CalendarApp.Calendar.createEvent
I'm trying to write a script for google apps script that will create an event everyday at 09:00 (UTC-4) and reporting the value displayed in the xpath //div/div/div/div/div/div/div/div/div/a displayed in this URL https://etherscan.io/address/0x260ee8f2b0c167e0cd6119b2df923fd061dc1093我正在尝试为谷歌应用程序脚本编写一个脚本,该脚本将在每天 09:00 (UTC-4) 创建一个事件并报告 xpath //div/div/div/div/div/div/div 中显示的值/div/div/a 显示在这个 URL https://etherscan.io/address/0x260ee8f2b0c167e0cd6119b2df923fd061dc1093
I tried to change so many things but i still don't understand why i get this error message:我尝试更改了很多东西,但我仍然不明白为什么会收到此错误消息:
"Exception: The parameters (String) don't match the method signature for CalendarApp.Calendar.createEvent." “异常:参数 (String) 与 CalendarApp.Calendar.createEvent 的方法签名不匹配。” Line 21 21号线
Please help请帮忙
function createEvent() {
var startTime = new Date();
startTime.setHours(9);
startTime.setMinutes(0);
startTime.setSeconds(0);
startTime.setUTCHours(-4);
var endTime = new Date();
endTime.setHours(10);
endTime.setMinutes(0);
endTime.setSeconds(0);
endTime.setUTCHours(-4);
var event = {
summary: 'Etherscan Value Report',
start: {
dateTime: startTime.toISOString(),
},
end: {
dateTime: endTime.toISOString(),
}
};
CalendarApp.getDefaultCalendar().createEvent(event);
}
function reportSpanValue() {
var response = UrlFetchApp.fetch("https://etherscan.io/address/0x260ee8f2b0c167e0cd6119b2df923fd061dc1093");
var html = response.getContentText();
var xpath = '//div/div/div/div/div/div/div/div/div/a';
var value = xpath.evaluate(html, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.innerHTML;
Logger.log(value);
}
function createTrigger() {
ScriptApp.newTrigger('reportSpanValue')
.timeBased()
.atHour(9)
.everyDays(1)
.atMinute(0)
.create();
}
To resolve this issue I tried to pass an event object to the createEvent method, not a string.为了解决这个问题,我尝试将事件 object 传递给 createEvent 方法,而不是字符串。 But it didn't work但它没有用
Try:尝试:
CalendarApp.getDefaultCalendar().createEvent('Etherscan Value Report',startTime,endTime)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.