views:

15

answers:

1

I've a Google spreadsheet in Google Apps. When I enter a date/time in spreadsheet, I want to create a corresponding entry in a particular Google Calendar? How can I do this?

This thread suggests some sort of scripting but complete solution is not given. And I'm using Google Apps instead of Google Docs as suggested by this thread.

Update : Found this thread helpful.

A: 
function caltest1() {
  var sheet = SpreadsheetApp.getActiveSheet();
  var startRow = 2;  // First row of data to process
  var numRows = 2;   // Number of rows to process
  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[0];  // First column
    var desc = row[1];       // Second column
    var tstart = row[2];
    var tstop = row[3];
    var loc = row[4];
    //cal.createEvent(title, new Date("March 3, 2010 08:00:00"), new Date("March 3, 2010 09:00:00"), {description:desc,location:loc});
    cal.createEvent(title, tstart, tstop, {description:desc,location:loc});
 }
}

Directly taken from here.

understack