【问题标题】:How to integrate Google Spreadsheet with Google Calendar?如何将 Google 电子表格与 Google 日历集成?
【发布时间】:2010-10-24 09:07:20
【问题描述】:

我在 Google Apps 中有一个 Google 电子表格。当我在电子表格中输入日期/时间时,我想在特定的 Google 日历中创建相应的条目?我该怎么做?

这个thread 建议使用某种脚本,但没有给出完整的解决方案。而且我正在使用 Google Apps 而不是此线程建议的 Google Docs。

更新:发现此thread 有帮助。

【问题讨论】:

    标签: google-apps-script google-sheets google-calendar-api


    【解决方案1】:
    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});
     }
    }
    

    直接取自here.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-22
      相关资源
      最近更新 更多