How to automatically add a schedule from Google sheets to Calendar using Apps Script
如何使用Apps腳本從googlesheets自動(dòng)添加日程表到日歷
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.
下面是一個(gè)使用Apps腳本從googlesheets自動(dòng)將日程表/事件添加到日歷的簡(jiǎn)單過(guò)程。
第一步:打開(kāi)一個(gè)Google表單,創(chuàng)建一個(gè)日程表或事件。

Step 2:?Click on Tools in the toolbar → Select Script?editor.
第2步:?jiǎn)螕艄ぞ邫谥械墓ぞ摺x擇腳本編輯器。

Step 3:?Copy this code and then change the highlighted portion
Note:?Choose your Calendar?Id.
步驟3:復(fù)制此代碼,然后更改突出顯示的部分
注意:選擇日歷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?
只需在谷歌瀏覽器上鍵入日歷,然后您就可以參考以下鏈接:
谷歌搜索日歷? 在設(shè)置里面可以獲取

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:保存代碼,然后運(yùn)行它。
步驟5:授予運(yùn)行腳本的權(quán)限。
選擇查看權(quán)限→選擇您的Google帳戶(hù)→選擇高級(jí)選項(xiàng)→單擊允許按鈕。


Step 6:?It will run Successfully?:)
You can check your Calendar?then.
第六步:運(yùn)行成功:)
你可以查一下你的日歷。

That’s it?:)
無(wú)了