Class CalendarApp

CalendarApp

스크립트가 사용자의 Google Calendar를 읽고 업데이트하도록 허용합니다. 이 클래스는 사용자의 기본 캘린더에 직접 액세스할 수 있는 기능과 사용자가 소유하거나 구독한 추가 캘린더를 가져올 수 있는 기능을 제공합니다.

속성

속성유형설명
ColorColor캘린더 서비스에서 사용할 수 있는 명명된 색상을 나타내는 enum입니다.
EventColorEventColorCalendar 서비스에서 사용할 수 있는 명명된 일정 색상을 나타내는 enum입니다.
EventTransparencyEventTransparencyEventTransparency 열거형
EventTypeEventTypeEventType 열거형
GuestStatusGuestStatus참석자가 일정에 대해 가질 수 있는 상태를 나타내는 열거형입니다.
MonthMonth연도의 월을 나타내는 enum입니다.
VisibilityVisibility이벤트의 공개 상태를 나타내는 열거형입니다.
WeekdayWeekday요일을 나타내는 enum입니다.

메서드

메서드반환 유형간략한 설명
createAllDayEvent(title, date)CalendarEvent새 종일 일정을 만듭니다.
createAllDayEvent(title, startDate, endDate)CalendarEvent여러 날에 걸쳐 진행될 수 있는 새 종일 일정을 만듭니다.
createAllDayEvent(title, startDate, endDate, options)CalendarEvent여러 날에 걸쳐 진행될 수 있는 새 종일 일정을 만듭니다.
createAllDayEvent(title, date, options)CalendarEvent새 종일 일정을 만듭니다.
createAllDayEventSeries(title, startDate, recurrence)CalendarEventSeries새 종일 일정 시리즈를 만듭니다.
createAllDayEventSeries(title, startDate, recurrence, options)CalendarEventSeries새 종일 일정 시리즈를 만듭니다.
createCalendar(name)Calendar사용자가 소유한 새 캘린더를 만듭니다.
createCalendar(name, options)Calendar사용자가 소유한 새 캘린더를 만듭니다.
createEvent(title, startTime, endTime)CalendarEvent새 일정을 만듭니다.
createEvent(title, startTime, endTime, options)CalendarEvent새 일정을 만듭니다.
createEventFromDescription(description)CalendarEvent자유 형식 설명에서 일정을 만듭니다.
createEventSeries(title, startTime, endTime, recurrence)CalendarEventSeries새 이벤트 시리즈를 만듭니다.
createEventSeries(title, startTime, endTime, recurrence, options)CalendarEventSeries새 이벤트 시리즈를 만듭니다.
getAllCalendars()Calendar[]사용자가 소유하거나 구독한 모든 캘린더를 가져옵니다.
getAllOwnedCalendars()Calendar[]사용자가 소유한 모든 캘린더를 가져옵니다.
getCalendarById(id)Calendar|null지정된 ID의 캘린더를 가져옵니다.
getCalendarsByName(name)Calendar[]사용자가 소유하거나 구독한 지정된 이름의 모든 캘린더를 가져옵니다.
getColor()String캘린더의 색상을 가져옵니다.
getDefaultCalendar()Calendar사용자의 기본 캘린더를 가져옵니다.
getDescription()String캘린더의 설명을 가져옵니다.
getEventById(iCalId)CalendarEvent지정된 ID의 이벤트를 가져옵니다.
getEventSeriesById(iCalId)CalendarEventSeries지정된 ID가 있는 이벤트 시리즈를 가져옵니다.
getEvents(startTime, endTime)CalendarEvent[]지정된 기간 내에 발생한 모든 이벤트를 가져옵니다.
getEvents(startTime, endTime, options)CalendarEvent[]지정된 기간 내에 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.
getEventsForDay(date)CalendarEvent[]지정된 날짜에 발생하는 모든 이벤트를 가져옵니다.
getEventsForDay(date, options)CalendarEvent[]특정 날짜에 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.
getId()String캘린더의 ID를 가져옵니다.
getName()String캘린더 이름을 가져옵니다.
getOwnedCalendarById(id)Calendar|null사용자가 소유한 경우 지정된 ID의 캘린더를 가져옵니다.
getOwnedCalendarsByName(name)Calendar[]사용자가 소유한 지정된 이름의 모든 캘린더를 가져옵니다.
getTimeZone()String캘린더의 시간대를 가져옵니다.
isHidden()Boolean캘린더가 사용자 인터페이스에서 숨겨져 있는지 여부를 확인합니다.
isMyPrimaryCalendar()Boolean캘린더가 유효한 사용자의 기본 캘린더인지 여부를 확인합니다.
isOwnedByMe()Boolean캘린더가 내 소유인지 여부를 확인합니다.
isSelected()Boolean캘린더의 이벤트가 사용자 인터페이스에 표시되는지 여부를 결정합니다.
newRecurrence()EventRecurrence이벤트 반복에 대한 규칙을 만드는 데 사용할 수 있는 새 반복 객체를 만듭니다.
setColor(color)Calendar캘린더의 색상을 설정합니다.
setDescription(description)Calendar캘린더의 설명을 설정합니다.
setHidden(hidden)Calendar캘린더가 사용자 인터페이스에 표시되는지 여부를 설정합니다.
setName(name)Calendar캘린더 이름을 설정합니다.
setSelected(selected)Calendar캘린더의 일정이 사용자 인터페이스에 표시되는지 여부를 설정합니다.
setTimeZone(timeZone)Calendar캘린더의 시간대를 설정합니다.
subscribeToCalendar(id)Calendar사용자가 구독할 수 있는 경우 지정된 ID의 캘린더를 사용자가 구독합니다.
subscribeToCalendar(id, options)Calendar사용자가 구독할 수 있는 경우 지정된 ID의 캘린더를 사용자가 구독합니다.

자세한 문서

createAllDayEvent(title, date)

새 종일 일정을 만듭니다.

// Creates an all-day event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969'),
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString이벤트 제목입니다.
dateDate이벤트 날짜 (일만 사용되고 시간은 무시됨)

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, startDate, endDate)

여러 날에 걸쳐 진행될 수 있는 새 종일 일정을 만듭니다.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and
// logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString이벤트 제목입니다.
startDateDate이벤트가 시작되는 날짜입니다 (날짜만 사용되고 시간은 무시됨).
endDateDate이벤트가 종료되는 날짜입니다 (일만 사용되고 시간은 무시됨). 종료일은 제외됩니다.

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, startDate, endDate, options)

여러 날에 걸쳐 진행될 수 있는 새 종일 일정을 만듭니다.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and
// logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
    {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true},
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString이벤트 제목입니다.
startDateDate이벤트가 시작되는 날짜입니다 (날짜만 사용되고 시간은 무시됨).
endDateDate이벤트가 종료되는 날짜입니다 (일만 사용되고 시간은 무시됨). 종료일은 제외됩니다.
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체입니다.

고급 파라미터

이름유형설명
descriptionString이벤트에 대한 설명입니다.
locationString이벤트의 위치입니다.
guestsString게스트로 추가해야 하는 이메일 주소를 쉼표로 구분한 목록입니다.
sendInvitesBoolean초대 이메일을 보낼지 여부입니다 (기본값: false).

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, date, options)

새 종일 일정을 만듭니다.

// Creates an all-day event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969'),
    {location: 'The Moon'},
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString이벤트 제목입니다.
dateDate이벤트 날짜 (일만 사용되고 시간은 무시됨)
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체입니다.

고급 파라미터

이름유형설명
descriptionString이벤트에 대한 설명입니다.
locationString이벤트의 위치입니다.
guestsString게스트로 추가해야 하는 이메일 주소를 쉼표로 구분한 목록입니다.
sendInvitesBoolean초대 이메일을 보낼지 여부입니다 (기본값: false).

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEventSeries(title, startDate, recurrence)

새 종일 일정 시리즈를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')),
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

매개변수

이름유형설명
titleString시리즈의 일정 제목
startDateDate시리즈의 첫 번째 이벤트 날짜 (일만 사용되고 시간은 무시됨)
recurrenceEventRecurrence일정 시리즈의 반복 설정

리턴

CalendarEventSeries - 생성된 이벤트 시리즈

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEventSeries(title, startDate, recurrence, options)

새 종일 일정 시리즈를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')),
    {guests: 'everyone@example.com'},
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

매개변수

이름유형설명
titleString시리즈의 일정 제목
startDateDate시리즈의 첫 번째 이벤트 날짜 (일만 사용되고 시간은 무시됨)
recurrenceEventRecurrence일정 시리즈의 반복 설정
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 파라미터

이름유형설명
descriptionString시리즈의 이벤트에 대한 설명
locationString반복 일정의 일정 위치
guestsString시리즈의 일정에 게스트로 추가해야 하는 이메일 주소의 쉼표로 구분된 목록
sendInvitesBoolean초대 이메일을 보낼지 여부 (기본값: false)

리턴

CalendarEventSeries - 생성된 이벤트 시리즈

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createCalendar(name)

사용자가 소유한 새 캘린더를 만듭니다.

// Creates a new calendar named "Travel Plans".
const calendar = CalendarApp.createCalendar('Travel Plans');
Logger.log(
    'Created the calendar "%s", with the ID "%s".',
    calendar.getName(),
    calendar.getId(),
);

매개변수

이름유형설명
nameString새 캘린더의 이름

리턴

Calendar - 새로 생성된 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createCalendar(name, options)

사용자가 소유한 새 캘린더를 만듭니다.

// Creates a new calendar named "Travel Plans" with a description and color.
const calendar = CalendarApp.createCalendar('Travel Plans', {
  description: 'A calendar to plan my travel schedule.',
  color: CalendarApp.Color.BLUE,
});
Logger.log(
    'Created the calendar "%s", with the ID "%s".',
    calendar.getName(),
    calendar.getId(),
);

매개변수

이름유형설명
nameString새 캘린더의 이름
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 파라미터

이름유형설명
locationString캘린더의 위치
descriptionString캘린더 설명
timeZoneString캘린더를 설정할 시간대입니다. 'long' 형식으로 지정됩니다 (예: 'America/New_York'(Joda.org에 나열됨)
colorString16진수 색상 문자열 ('#rrggbb') 또는 CalendarApp.Colors의 값
hiddenBoolean캘린더가 사용자 인터페이스에서 숨겨져 있는지 여부 (기본값: false)
selectedBoolean캘린더의 일정이 사용자 인터페이스에 표시되는지 여부 (기본값: true)

리턴

Calendar - 새로 생성된 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEvent(title, startTime, endTime)

새 일정을 만듭니다.

시간대가 지정되지 않으면 시간 값이 스크립트의 시간대 컨텍스트에서 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Creates an event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 21, 1969 21:00:00 UTC'),
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString일정 제목
startTimeDate이벤트가 시작되는 날짜와 시간
endTimeDate이벤트가 종료되는 날짜와 시간

리턴

CalendarEvent - 생성된 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEvent(title, startTime, endTime, options)

새 일정을 만듭니다.

시간대가 지정되지 않으면 시간 값이 스크립트의 시간대 컨텍스트에서 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Creates an event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 20, 1969 21:00:00 UTC'),
    {location: 'The Moon'},
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
titleString일정 제목
startTimeDate이벤트가 시작되는 날짜와 시간
endTimeDate이벤트가 종료되는 날짜와 시간
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 파라미터

이름유형설명
descriptionString이벤트에 대한 설명
locationString일정 위치
guestsString게스트로 추가해야 하는 이메일 주소의 쉼표로 구분된 목록
sendInvitesBoolean초대 이메일을 보낼지 여부 (기본값: false)

리턴

CalendarEvent - 생성된 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventFromDescription(description)

자유 형식 설명에서 일정을 만듭니다.

설명은 UI의 '빠르게 추가' 기능과 동일한 형식을 사용해야 합니다.

// Creates a new event and logs its ID.
const event = CalendarApp.getDefaultCalendar().createEventFromDescription(
    'Lunch with Mary, Friday at 1PM',
);
Logger.log(`Event ID: ${event.getId()}`);

매개변수

이름유형설명
descriptionString이벤트에 대한 자유 형식 설명

리턴

CalendarEvent - 생성된 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventSeries(title, startTime, endTime, recurrence)

새 이벤트 시리즈를 만듭니다.

// Creates an event series for a team meeting, taking place every Tuesday and
// Thursday in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createEventSeries(
    'Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekdays(
            [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')),
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

매개변수

이름유형설명
titleString시리즈의 일정 제목
startTimeDate시리즈의 첫 번째 이벤트가 시작되는 날짜 및 시간
endTimeDate시리즈의 첫 번째 이벤트가 종료되는 날짜 및 시간
recurrenceEventRecurrence일정 시리즈의 반복 설정

리턴

CalendarEventSeries - 생성된 이벤트 시리즈

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventSeries(title, startTime, endTime, recurrence, options)

새 이벤트 시리즈를 만듭니다.

// Creates an event series for a team meeting, taking place every Tuesday and
// Thursday in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createEventSeries(
    'Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekdays(
            [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')),
    {location: 'Conference Room'},
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

매개변수

이름유형설명
titleString시리즈의 일정 제목
startTimeDate시리즈의 첫 번째 이벤트가 시작되는 날짜 및 시간
endTimeDate시리즈의 첫 번째 이벤트가 종료되는 날짜 및 시간
recurrenceEventRecurrence일정 시리즈의 반복 설정
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 파라미터

이름유형설명
descriptionString시리즈의 이벤트에 대한 설명
locationString반복 일정의 일정 위치
guestsString시리즈의 일정에 게스트로 추가해야 하는 이메일 주소의 쉼표로 구분된 목록
sendInvitesBoolean초대 이메일을 보낼지 여부 (기본값: false)

리턴

CalendarEventSeries - 생성된 이벤트 시리즈

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

getAllCalendars()

사용자가 소유하거나 구독한 모든 캘린더를 가져옵니다.

// Determines how many calendars the user can access.
const calendars = CalendarApp.getAllCalendars();
Logger.log(
    'This user owns or is subscribed to %s calendars.',
    calendars.length,
);

리턴

Calendar[]: 사용자가 액세스할 수 있는 모든 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getAllOwnedCalendars()

사용자가 소유한 모든 캘린더를 가져옵니다.

// Determines how many calendars the user owns.
const calendars = CalendarApp.getAllOwnedCalendars();
Logger.log('This user owns %s calendars.', calendars.length);

리턴

Calendar[] - 사용자가 소유한 모든 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getCalendarById(id)

지정된 ID의 캘린더를 가져옵니다.

// Gets the public calendar "US Holidays" by ID.
const calendar = CalendarApp.getCalendarById(
    'en.usa#holiday@group.v.calendar.google.com',
);
Logger.log('The calendar is named "%s".', calendar.getName());

매개변수

이름유형설명
idString캘린더 ID

리턴

Calendar|null - 지정된 ID의 캘린더 또는 캘린더가 존재하지 않거나, 사용자가 액세스할 수 없거나, 사용자가 캘린더를 구독하지 않은 경우 null

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getCalendarsByName(name)

사용자가 소유하거나 구독한 지정된 이름의 모든 캘린더를 가져옵니다. 이름은 대소문자를 구분하지 않습니다.

// Gets the public calendar named "US Holidays".
const calendars = CalendarApp.getCalendarsByName('US Holidays');
Logger.log('Found %s matching calendars.', calendars.length);

매개변수

이름유형설명
nameString캘린더 이름

리턴

Calendar[]: 사용자가 액세스할 수 있는 이 이름의 모든 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getColor()

캘린더의 색상을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the color of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getColor() instead.
const calendarColor = calendar.getColor();
console.log(calendarColor);

리턴

String - 16진수 색상 문자열 ('#rrggbb')입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getDefaultCalendar()

사용자의 기본 캘린더를 가져옵니다.

// Determines the time zone of the user's default calendar.
const calendar = CalendarApp.getDefaultCalendar();
Logger.log(
    'My default calendar is set to the time zone "%s".',
    calendar.getTimeZone(),
);

리턴

Calendar - 사용자의 기본 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getDescription()

캘린더의 설명을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Sets the description of the calendar to 'Test description.'
calendar.setDescription('Test description');

// Gets the description of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getDescription() instead.
const description = calendar.getDescription();
console.log(description);

리턴

String - 이 캘린더에 대한 설명입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventById(iCalId)

지정된 ID의 이벤트를 가져옵니다. 시리즈가 기본 캘린더가 아닌 캘린더에 속하는 경우 이 메서드는 해당 캘린더에서 호출해야 합니다. getEventById(iCalId)만 호출하면 기본 캘린더의 일정이 반환됩니다.

이벤트 시리즈에 속하는 경우 여러 이벤트의 ID가 동일할 수 있습니다. 이 경우 이 메서드는 해당 시리즈의 첫 번째 이벤트만 반환합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Creates an event for the moon landing.
const event = calendar.createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:05:00 UTC'),
    new Date('July 20, 1969 20:17:00 UTC'),
);

// Gets the calendar event ID and logs it to the console.
const iCalId = event.getId();
console.log(iCalId);

// Gets the event by its ID and logs the title of the event to the console.
// For the default calendar, you can use CalendarApp.getEventById(iCalId)
// instead.
const myEvent = calendar.getEventById(iCalId);
console.log(myEvent.getTitle());

매개변수

이름유형설명
iCalIdString이벤트 ID입니다.

리턴

CalendarEvent - 지정된 ID의 이벤트입니다. 이벤트가 없거나 사용자가 액세스할 수 없는 경우 null입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventSeriesById(iCalId)

지정된 ID가 있는 이벤트 시리즈를 가져옵니다. 지정된 ID가 단일 CalendarEvent인 경우 시리즈에 단일 이벤트가 있는 CalendarEventSeries가 반환됩니다. 일정 시리즈가 기본 캘린더가 아닌 다른 캘린더에 속하는 경우 이 메서드는 해당 CalendarApp에서 호출해야 합니다. getEventSeriesById(iCalId)을 직접 호출하면 기본 캘린더에 있는 일정 시리즈만 반환됩니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Creates an event series for a daily team meeting from 1 PM to 2 PM.
// The series adds the daily event from January 1, 2023 through December 31,
// 2023.
const eventSeries = calendar.createEventSeries(
    'Team meeting',
    new Date('Jan 1, 2023 13:00:00'),
    new Date('Jan 1, 2023 14:00:00'),
    CalendarApp.newRecurrence().addDailyRule().until(new Date('Jan 1, 2024')),
);

// Gets the ID of the event series.
const iCalId = eventSeries.getId();

// Gets the event series by its ID and logs the series title to the console.
// For the default calendar, you can use CalendarApp.getEventSeriesById(iCalId)
// instead.
console.log(calendar.getEventSeriesById(iCalId).getTitle());

매개변수

이름유형설명
iCalIdString이벤트 시리즈의 ID입니다.

리턴

CalendarEventSeries - 지정된 ID의 시리즈입니다. 시리즈가 없거나 사용자가 액세스할 수 없는 경우 null입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEvents(startTime, endTime)

지정된 기간 내에 발생한 모든 이벤트를 가져옵니다.

이 메서드는 지정된 기간 중에 시작되거나, 기간 중에 종료되거나, 기간을 포함하는 이벤트를 반환합니다. 시간대가 지정되지 않으면 시간 값이 스크립트의 시간대 컨텍스트에서 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Determines how many events are happening in the next two hours.
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow);
Logger.log(`Number of events: ${events.length}`);

매개변수

이름유형설명
startTimeDate기간의 시작
endTimeDate시간 범위의 끝(포함되지 않음)

리턴

CalendarEvent[] - 기간 내에 발생하는 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEvents(startTime, endTime, options)

지정된 기간 내에 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.

이 메서드는 지정된 기간에 시작되거나, 기간에 종료되거나, 기간을 포함하는 이벤트를 반환합니다. 시간대가 지정되지 않으면 시간 값이 스크립트의 시간대 컨텍스트에서 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

author, search 또는 statusFilters를 기준으로 필터링하는 작업은 startmax를 적용한 후에 이루어집니다. 즉, 추가 이벤트가 기준을 충족하더라도 반환되는 이벤트 수가 max보다 적을 수 있습니다.

// Determines how many events are happening in the next two hours that contain
// the term "meeting".
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const events = CalendarApp.getDefaultCalendar().getEvents(
    now,
    twoHoursFromNow,
    {search: 'meeting'},
);
Logger.log(`Number of events: ${events.length}`);

매개변수

이름유형설명
startTimeDate기간의 시작
endTimeDate시간 범위의 끝(포함되지 않음)
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 파라미터

이름유형설명
startInteger반환할 첫 번째 이벤트의 색인
maxInteger반환할 최대 이벤트 수
authorString이벤트 생성자가 결과를 필터링하는 데 사용하는 이메일 주소
searchString결과를 필터링하는 데 사용되는 전체 텍스트 검색 쿼리
statusFilters[]GuestStatus결과를 필터링하는 데 사용되는 상태 배열

리턴

CalendarEvent[] - 기간 내에 발생하고 기준과 일치하는 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventsForDay(date)

지정된 날짜에 발생하는 모든 이벤트를 가져옵니다.

이 메서드는 이벤트가 지정된 날짜에 시작되거나, 지정된 날짜에 종료되거나, 지정된 날짜를 포함하는 경우 이벤트를 반환합니다.

Date 객체의 날짜 부분만 사용되고 시간 부분은 무시됩니다. 날짜는 캘린더의 시간대에서 해당 날짜의 자정부터 다음 날 자정까지로 해석됩니다.

// Determines how many events are happening today.
const today = new Date();
const events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
Logger.log(`Number of events: ${events.length}`);

매개변수

이름유형설명
dateDate이벤트를 가져올 날짜입니다 (일만 사용되고 시간은 무시됨).

리턴

CalendarEvent[]: 지정된 날짜에 발생하는 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventsForDay(date, options)

특정 날짜에 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.

이 메서드는 이벤트가 지정된 날짜에 시작되거나, 지정된 날짜에 종료되거나, 지정된 날짜를 포함하는 경우 이벤트를 반환합니다.

Date 객체의 날짜 부분만 사용되고 시간 부분은 무시됩니다. 날짜는 캘린더의 시간대에서 해당 날짜의 자정부터 다음 날 자정까지로 해석됩니다.

author, search 또는 statusFilters를 기준으로 필터링하는 작업은 startmax를 적용한 후에 이루어집니다. 즉, 추가 이벤트가 기준을 충족하더라도 반환되는 이벤트 수가 max보다 적을 수 있습니다.

// Determines how many events are happening today and contain the term
// "meeting".
const today = new Date();
const events = CalendarApp.getDefaultCalendar().getEventsForDay(today, {
  search: 'meeting',
});
Logger.log(`Number of events: ${events.length}`);

매개변수

이름유형설명
dateDate이벤트를 가져올 날짜입니다 (일만 사용되고 시간은 무시됨).
optionsObject고급 필터링 옵션

고급 파라미터

이름유형설명
startInteger반환할 첫 번째 이벤트의 색인
maxInteger반환할 최대 이벤트 수
authorString이벤트 생성자가 결과를 필터링하는 데 사용하는 이메일 주소
searchString결과를 필터링하는 데 사용되는 전체 텍스트 검색 쿼리
statusFilters[]GuestStatus결과를 필터링하는 데 사용되는 상태 배열

리턴

CalendarEvent[]: 지정된 날짜에 발생하고 기준과 일치하는 이벤트

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getId()

캘린더의 ID를 가져옵니다. 사용자의 기본 캘린더 ID는 이메일 주소입니다.

// Opens the calendar by its ID.
// To get the user's default calendar, use CalendarApp.getDefaultCalendar().
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the ID of the calendar and logs it to the console.
const calendarId = calendar.getId();
console.log(calendarId);

리턴

String: 캘린더의 ID입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getName()

캘린더 이름을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the name of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getName() instead.
const calendarName = calendar.getName();
console.log(calendarName);

리턴

String - 이 캘린더의 이름입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getOwnedCalendarById(id)

사용자가 소유한 경우 지정된 ID의 캘린더를 가져옵니다.

캘린더 ID를 찾으려면 Google Calendar에서 캘린더 이름 옆에 있는 화살표를 클릭하고 캘린더 설정을 선택합니다. ID는 설정 페이지 하단에 표시됩니다.

// Gets a (non-existent) private calendar by ID.
const calendar = CalendarApp.getOwnedCalendarById(
    '123456789@group.calendar.google.com',
);
Logger.log('The calendar is named "%s".', calendar.getName());

매개변수

이름유형설명
idString캘린더 ID

리턴

Calendar|null - 지정된 ID의 캘린더 또는 캘린더가 없거나 사용자가 소유하지 않은 경우 null

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getOwnedCalendarsByName(name)

사용자가 소유한 지정된 이름의 모든 캘린더를 가져옵니다. 이름은 대소문자를 구분하지 않습니다.

// Gets a private calendar named "Travel Plans".
const calendars = CalendarApp.getOwnedCalendarsByName('Travel Plans');
Logger.log('Found %s matching calendars.', calendars.length);

매개변수

이름유형설명
nameString캘린더 이름

리턴

Calendar[] - 사용자가 소유한 이 이름의 모든 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getTimeZone()

캘린더의 시간대를 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the time zone of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getTimeZone() instead.
const timeZone = calendar.getTimeZone();
console.log(timeZone);

리턴

String - 시간대입니다. 'long' 형식으로 지정됩니다 (예: Joda.org에 나열된 'America/New_York').

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isHidden()

캘린더가 사용자 인터페이스에서 숨겨져 있는지 여부를 확인합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Determines whether the calendar is hidden in the user interface and logs it
// to the console. For the default calendar, you can use CalendarApp.isHidden()
// instead.
const isHidden = calendar.isHidden();
console.log(isHidden);

리턴

Boolean - 캘린더가 사용자 인터페이스에 숨겨져 있는 경우 true, 숨겨져 있지 않은 경우 false

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isMyPrimaryCalendar()

캘린더가 유효한 사용자의 기본 캘린더인지 여부를 확인합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Determines whether the calendar is the default calendar for
// the effective user and logs it to the console.
// For the default calendar, you can use CalendarApp.isMyPrimaryCalendar()
// instead.
const isMyPrimaryCalendar = calendar.isMyPrimaryCalendar();
console.log(isMyPrimaryCalendar);

리턴

Boolean - true(캘린더가 유효한 사용자의 기본 캘린더인 경우), false(그렇지 않은 경우)

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isOwnedByMe()

캘린더가 내 소유인지 여부를 확인합니다.

// Gets a calendar by its ID. To get the user's default calendar, use
// CalendarApp.getDefault() instead.
// TODO(developer): Replace the ID with the calendar ID that you want to use.
const calendar = CalendarApp.getCalendarById(
    'abc123456@group.calendar.google.com',
);

// Determines whether the calendar is owned by you and logs it.
console.log(calendar.isOwnedByMe());

리턴

Boolean - 캘린더를 소유한 경우 true, 소유하지 않은 경우 false

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isSelected()

캘린더의 이벤트가 사용자 인터페이스에 표시되는지 여부를 결정합니다.

// Gets the user's default calendar. To get a different calendar,
// use getCalendarById() instead.
const calendar = CalendarApp.getDefaultCalendar();

// Determines whether the calendar's events are displayed in the user interface
// and logs it.
console.log(calendar.isSelected());

리턴

Boolean~true: 캘린더의 이벤트가 사용자 인터페이스에 표시되는 경우, false: 그렇지 않은 경우

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

newRecurrence()

이벤트 반복에 대한 규칙을 만드는 데 사용할 수 있는 새 반복 객체를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const recurrence = CalendarApp.newRecurrence()
                       .addWeeklyRule()
                       .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
                       .until(new Date('January 1, 2014'));
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    recurrence,
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

리턴

EventRecurrence - 규칙이 설정되지 않은 새 반복 객체 (주간 반복으로 작동)

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

setColor(color)

캘린더의 색상을 설정합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Sets the color of the calendar to pink using the Calendar Color enum.
// For the default calendar, you can use CalendarApp.setColor() instead.
calendar.setColor(CalendarApp.Color.PINK);

매개변수

이름유형설명
colorStringCalendarApp.Color 또는 16진수 색상 문자열('#rrggbb')입니다.

리턴

Calendar - 체이닝을 위한 이 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setDescription(description)

캘린더의 설명을 설정합니다.

// Gets the user's default calendar. To get a different calendar,
// use getCalendarById() instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the description of the calendar.
// TODO(developer): Update the string with the description that you want to use.
calendar.setDescription('Updated calendar description.');

매개변수

이름유형설명
descriptionString이 캘린더의 설명

리턴

Calendar - 연결용 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setHidden(hidden)

캘린더가 사용자 인터페이스에 표시되는지 여부를 설정합니다.

매개변수

이름유형설명
hiddenBooleantrue를 클릭하여 사용자 인터페이스에서 캘린더를 숨기고 false를 클릭하여 표시합니다.

리턴

Calendar - 연결용 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setName(name)

캘린더 이름을 설정합니다.

// Gets the user's default calendar. To get a different calendar,
// use getCalendarById() instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the name of the calendar.
// TODO(developer): Update the string with the name that you want to use.
calendar.setName('Example calendar name');

매개변수

이름유형설명
nameString새 이름

리턴

Calendar - 연결용 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setSelected(selected)

캘린더의 일정이 사용자 인터페이스에 표시되는지 여부를 설정합니다.

// Gets the user's default calendar. To get a different calendar,
// use getCalendarById() instead.
const calendar = CalendarApp.getDefaultCalendar();

// Selects the calendar so that its events are displayed in the user interface.
// To unselect the calendar, set the parameter to false.
calendar.setSelected(true);

매개변수

이름유형설명
selectedBooleantrue: 사용자 인터페이스에 캘린더의 일정을 표시합니다. false: 일정을 숨깁니다.

리턴

Calendar - 연결용 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setTimeZone(timeZone)

캘린더의 시간대를 설정합니다.

// Gets the user's default calendar. To get a different calendar,
// use getCalendarById() instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the time zone of the calendar to America/New York (US/Eastern) time.
calendar.setTimeZone('America/New_York');

매개변수

이름유형설명
timeZoneString시간대입니다. 'long' 형식으로 지정됩니다 (예: Joda.org에 나열된 'America/New_York').

리턴

Calendar - 체이닝을 위한 이 캘린더

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

subscribeToCalendar(id)

사용자가 구독할 수 있는 경우 지정된 ID의 캘린더를 사용자가 구독합니다.

// Subscribe to the calendar "US Holidays".
const calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com',
);
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

매개변수

이름유형설명
idString구독할 캘린더의 ID

리턴

Calendar: 새로 구독한 캘린더

생성 값

Error - 이 ID의 캘린더가 없는 경우

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

subscribeToCalendar(id, options)

사용자가 구독할 수 있는 경우 지정된 ID의 캘린더를 사용자가 구독합니다.

// Subscribe to the calendar "US Holidays", and set it to the color blue.
const calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com',
    {color: CalendarApp.Color.BLUE},
);
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

매개변수

이름유형설명
idString구독할 캘린더의 ID입니다.
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체입니다.

고급 파라미터

이름유형설명
colorString16진수 색상 문자열 ('#rrggbb') 또는 CalendarApp.Colors의 값입니다.
hiddenBoolean캘린더가 사용자 인터페이스에 숨겨져 있는지 여부입니다 (기본값: false).
selectedBoolean캘린더의 일정이 사용자 인터페이스에 표시되는지 여부입니다 (기본값: color도 지정된 경우 true, 그렇지 않은 경우 false).

리턴

Calendar - 새로 구독한 캘린더입니다.

생성 값

Error - 이 ID의 캘린더가 없는 경우

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds