# scheduler-sync-google-calendar

> Scheduler sample syncing events with Google Calendar and calendar APIs.

**Framework:** javascript  **Component:** Scheduler  **Variant:** sync-google-calendar

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/javascript/scheduler-sync-google-calendar.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-schedule
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/scheduler-sync-google-calendar/scheduler.html

```html
<div class="control-section">
    <div class="content-wrapper">
        <div id="container">
        </div>
    </div>
</div>
```

### src/components/scheduler-sync-google-calendar/scheduler.ts

```typescript
import { Schedule, Day, Week, WorkWeek, Month, Agenda } from '@syncfusion/ej2-schedule';
import { DataManager, WebApiAdaptor } from '@syncfusion/ej2-data';

Schedule.Inject(Day, Week, WorkWeek, Month, Agenda);

/**
 * Schedule google calendar integration sample
 */

export function initSchedulerSyncGoogleCalendar(): void {
    const CALENDAR_ID: string = 'en.usa%23holiday@group.v.calendar.google.com';
    const PUBLIC_KEY: string = '<your key>';
    let dataManger: DataManager = new DataManager({
        url: 'https://www.googleapis.com/calendar/v3/calendars/' + CALENDAR_ID + '/events?key=' + PUBLIC_KEY,
        adaptor: new WebApiAdaptor(),
        crossDomain: true
    });
    let scheduleObj: Schedule = new Schedule({
        width: '100%',
        height: '650px',
        eventSettings: { dataSource: dataManger },
        readonly: true,
        currentView: 'Month',
        timezone: 'UTC',
        dataBinding: (e: Record<string, any>) => {
            let items: Record<string, any>[] = (e.result as Record<string, Record<string, any>[]>).items;
            let scheduleData: Object[] = [];
            if (items.length > 0) {
                for (let i: number = 0; i < items.length; i++) {
                    let event: Record<string, any> = items[i];
                    let when: string = event.start.dateTime as string;
                    let start: string = event.start.dateTime as string;
                    let end: string = event.end.dateTime as string;
                    if (!when) {
                        when = event.start.date as string;
                        start = event.start.date as string;
                        end = event.end.date as string;
                    }
                    scheduleData.push({
                        Id: event.id,
                        Subject: event.summary,
                        StartTime: start,
                        EndTime: end,
                        IsAllDay: !event.start.dateTime
                    });
                }
            }
            e.result = scheduleData;
        }
    });
    scheduleObj.appendTo('#container');
}

```
