0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

miriwoお一人様Advent Calendar 2024

Day 21

GAS実行日のGoogleカレンダーの予定のタイトルを出力してみる

Last updated at Posted at 2024-12-05

概要

GASを使って実行日のGoogleカレンダーの予定を出力してみる。

方法

  • 下記の方法で予定を取得したいカレンダーIDを確認

  • 下記のコードを記載して実行(予定のタイトルが順々に出力される。)

    main.gs
    function myFunction() {
      const calendarId = 'カレンダーIDを設定';
      const calendar = CalendarApp.getCalendarById(calendarId);
    
      if (calendar === null) {
        console.log('カレンダーが取得できません。');
        return false;
      }
    
      const today = new Date();
      const todayEvents = calendar.getEventsForDay(today);
      todayEvents.forEach((todayEvent) => {
        console.log(todayEvent.getTitle());
      });
    
      return true;
    }
    

参考文献

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?