简体   繁体   English

Google Apps 脚本:参数(字符串)与 CalendarApp.Calendar.createEvent 的方法签名不匹配

[英]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.

相关问题 Google Sheets Apps 脚本 RichTextValueBuilder 参数与方法签名不匹配 - Google Sheets Apps Script RichTextValueBuilder Parameters Don't Match method Signature 例外:参数(字符串)与 SpreadsheetApp.Sheet.getName 的方法签名不匹配。 - 应用脚本 - Exception: The parameters (String) don't match the method signature for SpreadsheetApp.Sheet.getName. - Apps Script Google Sheet/App Script - 参数与 Utilities.computeDigest 的方法签名不匹配 - Google Sheet/App Script - parameters don't match the method signature for Utilities.computeDigest 参数 (String,number) 与 getRange() 的方法签名不匹配 - The parameters (String,number) don't match the method signature for getRange() Google Apps脚本-createEvent函数未创建日历事件 - Google Apps Script - createEvent function not creating calendar event 为Google应用程序脚本CalendarApp.createEvent()创建GUI - create a gui for google app script CalendarApp.createEvent() Google Apps 脚本日历,我的 createEvent 语法不再起作用 - Google Apps Script Calendar, my syntax with createEvent doesn't work anymore Google脚本Google日历TypeError:无法调用null的方法“ createEvent” - Google script google calendar TypeError: Cannot call method “createEvent” of null 例外:参数 (String,number,String) 与 SpreadsheetApp.Spreadsheet.getRange 的方法签名不匹配 - Exception: The parameters (String,number,String) don't match the method signature for SpreadsheetApp.Spreadsheet.getRange 例外:参数(字符串)与 DriveApp.File.moveTo 的方法签名不匹配 - Exception: The parameters (String) don't match the method signature for DriveApp.File.moveTo
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM