Bulk move calendar events from one Google Calendar to another Google Calendar using Google Apps Script with Google Calendar API
利用 Google Apps Script 及 Google Calendar API 編寫的小程式,可批次修改 (bulk edit) Google Calendar 的事件。
- In your Google Drive, create a new Apps Script project.
- Copy the codes in
_moveTo.gs
,calendarAPI.gs
, and_config.gs
from the repository to the Editor. - In the script editor, select Resources > Advanced Google services....
- In the Advanced Google Service dialog that appears, click the on/off switch next to the Calendar API service to enable it.
- Click OK to close the dialog.
- Open the
_config.gs
file, declare your Calendar Ids to theCal_Id
object.
- Change the
enddate
in line 4 ofmoveTo.gs
. - By default, the
startdate
in line 5 is defined as 31 days before theenddate
. Please change the code if you want to set a different period of date. - In line 12, the
Move1To2()
function moves the events from Calendar1 to Calendar2. Plesae create a custom function if you need to process multiple sets. - Replace the value for the
kword
variable (line 19) inside theMove1To2()
function with the query keyword for the calendar events. - Run the
doGet()
function.
Note: A dialog will pop up for authorization when you run the script for the first run. - Verify the update in your Google Calendar.