Posts

Showing posts with the label IT Notes

IT Notes : Using Google Apps Script to export Google Calendar events to Google Sheet

Image
Steps : 1.      Open Google Calendar and export events to Google sheet  2.      Create a 5 columns Google Sheet with sheet name " Feb 2023"   : Date, Start time, End time, Time slot hours, Total hours for the week 3.      Apply the following format for columns : Date : date (dd/mm/yyyy) Start time : time (hh:mm:ss) End time : time (hh:mm:ss) Time slot hours : number 4.      Create a Google App Script using the Google Calendar API Service : function MonthSchedule(){   var ss = SpreadsheetApp.getActiveSpreadsheet();   var sheet = ss.getSheetByName("Feb 2023");   var cal = CalendarApp.getCalendarById("xxxxx@gmail.com");   //用 getEvents(startTime, endTime) 來取得資料, e.g. Feb 2023   var events = cal.getEvents(new Date("2/01/2023 12:00 AM"), new Date("2/28/2023 11:59 PM"));   for(var i = 0;i<events.length;i++){     var title = events[i].getTitle();     ...