Connect Google Calender to Spreadsheets using Apps Script

Learn how to easily connect your Google Calendar to your Google Spreadsheet using Apps Script! There's a Hangout on Air video I did along with posting the source code. Hope you all enjoy :)

Source code

As mentioned in the video here is the source code!
function listCal(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  cell = sheet.getRange("A1");

  cApp = CalendarApp.getAllCalendars();
  for (var b = 0;b < cApp.length;b++){
    var events = cApp[b].getEvents(new Date("March 1, 2012 EST"), 
            new Date("July 22, 2012 EST"));
      for ( var j=0;j< events.length;j++){

Popup Window Source Code

Pops up a window, asks for a number, saves it to cell and gives it back to you (plus one).
function example() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  var myValue = Browser.inputBox("Enter a number"); 
  sheet.getRange("A1").setValue("Number entered:");
  var b1Range = sheet.getRange("B1");
  var valueToShow = b1Range.getValue() + 1;
  Browser.msgBox("The value you entered plus one is: " + valueToShow);

Popular posts from this blog

How to create a Chrome Extension

Connect to Gmail with Apps Script