Comment intégrer Google Spreadsheet avec Google Agenda?
-
25-09-2019 - |
Question
J'ai une feuille de calcul Google dans Google Apps. Quand j'entre une date / heure dans une feuille de calcul, je veux créer une entrée correspondante dans un calendrier Google particulier? Comment puis-je faire?
La solution
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});
}
}
Directement tiré de ici.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow