I’ve been trying to run a script in order to sync my google spreadsheet with my google calendar, however, I get the error message: Cannot find method createEvent(string,string,string,object). (line 15, file "Code")
The script that I entered is:
There is a total of 199 rows not including the header row. I have date/time in the first row, the event in the second, and the country where the event is taking place in the third column. Can you let me know how I can run this so it imports all the events into a google calendar I have created and updates automatically when new events are entered into the spreadsheet? The google spreadsheet was from an excel file I imported.HTML Code:function caltest1() { var sheet = SpreadsheetApp.getActiveSheet(); var startRow = 2; var numRows = 199; var dataRange = sheet.getRange(startRow, 1, numRows, 5); var data = dataRange.getValues(); var cal = CalendarApp.getDefaultCalendar(); for (i in data) { var row = data[i]; var title = row[2]; var desc = row[3]; var tstart = row[1]; var tstop = row[1]; var loc = row[3]; cal.createEvent(title, tstart, tstop, {description:desc,location:loc}); } }



Reply With Quote
