How to automatically add a schedule from Google sheets to Calendar using Apps Script
如何使用Apps脚本从googlesheets自动添加日程表到日历
Here is the simple procedure to automatically add a schedule/event from the Google sheets to Calendar using the Apps Script.
Step 1: Open a Google Sheet and create a schedule or an event.
下面是一个使用Apps脚本从googlesheets自动将日程表/事件添加到日历的简单过程。
第一步:打开一个Google表单,创建一个日程表或事件。

Step 2: Click on Tools in the toolbar → Select Script editor.
第2步:单击工具栏中的工具→选择脚本编辑器。

Step 3: Copy this code and then change the highlighted portion
Note: Choose your Calendar Id.
步骤3:复制此代码,然后更改突出显示的部分
注意:选择日历Id。
function scheduleShifts() {
var spreadsheet = SpreadsheetApp.getActiveSheet();
var calendarID = spreadsheet.getRange("C4").getValue();
var eventCal = CalendarApp.getCalendarById("calendarId");var signups = spreadsheet.getRange("A5:C7").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);
}
}
How to choose your Calendar Id?
Just type Calendar on the Google browser and then you can refer to the below link:
如何选择日历Id?
只需在谷歌浏览器上键入日历,然后您就可以参考以下链接:
谷歌搜索日历 在设置里面可以获取

Step 4: Save the code and then run it.
Step 5: Give the Authorization to run the script.
Select Review Permissions →Choose your Google Account →Select Advanced Options →Click on AllowButton.
步骤4:保存代码,然后运行它。
步骤5:授予运行脚本的权限。
选择查看权限→选择您的Google帐户→选择高级选项→单击允许按钮。


Step 6: It will run Successfully :)
You can check your Calendar then.
第六步:运行成功:)
你可以查一下你的日历。

That’s it :)
无了
网友评论