如何自动将 Google 表格中的日程添加到日历中?
how to automatically add a schedule from Google Sheets into Calendar?
我试图实现此代码以将 google 日历与我的电子表格集成,但直到现在我都失败了。按照代码...
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
for (x=0; x<signups.length;x++)
{
var shift = signups[x];
var startTime = shift[0];
var endTime = shift[1];
var volunteer= shift[2];
eventCal.createEvent(volunteer,startTime,endTime);
}
}
错误信息:
21:19:29 错误异常:参数(字符串、字符串、字符串)与 CalendarApp.Calendar.createEvent 的方法签名不匹配。 scheduleShifts @ Agenda.gs:12
基于文章:
你能帮帮我吗?
试试这个:
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
for (x=0; x<signups.length;x++) {
var shift = signups[x];
var startTime = new Date(shift[0]);
var endTime = new Date(shift[1]);
var volunteer= shift[2];
eventCal.createEvent(volunteer,startTime,endTime);
}
}
calendar#createEvent 的方法签名是
您当前正在发送字符串参数 (String,String,String)。如错误信息所示
Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent. scheduleShifts
虽然该方法要求开始日期和结束日期实际上都是日期而不是字符串。
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
new Date('July 20, 1969 20:00:00 UTC'),
new Date('July 21, 1969 21:00:00 UTC'));
Logger.log('Event ID: ' + event.getId());
我试图实现此代码以将 google 日历与我的电子表格集成,但直到现在我都失败了。按照代码...
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
for (x=0; x<signups.length;x++)
{
var shift = signups[x];
var startTime = shift[0];
var endTime = shift[1];
var volunteer= shift[2];
eventCal.createEvent(volunteer,startTime,endTime);
}
}
错误信息:
21:19:29 错误异常:参数(字符串、字符串、字符串)与 CalendarApp.Calendar.createEvent 的方法签名不匹配。 scheduleShifts @ Agenda.gs:12
基于文章:
你能帮帮我吗?
试试这个:
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarId = spreadsheet.getRange("Dados!CJ3").getValue();
var eventCal = CalendarApp.getCalendarById(calendarId);
var signups = spreadsheet.getRange("Dados!CI5:CK3500").getValues();
for (x=0; x<signups.length;x++) {
var shift = signups[x];
var startTime = new Date(shift[0]);
var endTime = new Date(shift[1]);
var volunteer= shift[2];
eventCal.createEvent(volunteer,startTime,endTime);
}
}
calendar#createEvent 的方法签名是
您当前正在发送字符串参数 (String,String,String)。如错误信息所示
Exception: The parameters (String,String,String) don't match the method signature for CalendarApp.Calendar.createEvent. scheduleShifts
虽然该方法要求开始日期和结束日期实际上都是日期而不是字符串。
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
new Date('July 20, 1969 20:00:00 UTC'),
new Date('July 21, 1969 21:00:00 UTC'));
Logger.log('Event ID: ' + event.getId());