Skip to content

Instantly share code, notes, and snippets.

@fabichirox
Last active November 9, 2015 06:30
Show Gist options
  • Save fabichirox/76132e4bce5c7f5ea5cd to your computer and use it in GitHub Desktop.
Save fabichirox/76132e4bce5c7f5ea5cd to your computer and use it in GitHub Desktop.

###やったこと

  • Google App Scriptの勉強
  • スプレッドシートからCreateEvent,sendInvitesできるScriptを書いた

###インスコしたもの

  • なし

###コード

  • 以下
function createEventFromSheet() {
var sheet, i, myevent, mystart, myend, mylocation, myuser;
sheet = SpreadsheetApp.getActiveSheet();
for(i = 2; i <= sheet.getLastRow(); i++) {
myevent = sheet.getRange(i, 1)
.getValue();
mystart = sheet.getRange(i, 2)
.getValue();
myend = sheet.getRange(i, 3)
.getValue();
mylocation = sheet.getRange(i, 4)
.getValue();
myuser = sheet.getRange(i, 5)
.getValue();
CalendarApp.getDefaultCalendar()
.createEvent(myevent, mystart, myend,{
location: mylocation,
guests:myuser,
sendInvites :true
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment