Question

Google Calendar Find Event only return max 5 events? How to get full day event that more than 5

  • 7 January 2024
  • 2 replies
  • 89 views

https://actions.zapier.com/demo/

I am using Zapier AI Actions: Live Demo AI alpha to testing my Google Calendar Find Event function.

It returns 1 main result and 4 additional result.

It seems can not return more than 5 results.

If I have more than 5 events in one day, it seems can not give me my full day schedule.

May I know, is there any way to get full day schedule by using Google Calendar Find Event?

I am testing Zapier Action is because I am trying duplicating Google Calendar Assistant GPTs demonstrated on GPT keynote day. It seems always only return <= 5 result. 

I want to get a full day schedule for that. Is there way to get full fucntion..

 

 


2 replies

Userlevel 7
Badge +14

Hi @yfJiang_080970 

We would need to see screenshots with how your custom action is configured to have full context.

 

Or you may need to explore using the GCal API via the API Request option:

 

https://developers.google.com/calendar/api/v3/reference/events/list

 

 

Hi Troy

 

My setting for Actions is just like picture.

 

 

I tried using test python code to directly using Google Calendar API as below and it successfully return numbers of events say 30.   

 

Python code:  

from datetime import datetime, timedelta

from google.oauth2.credentials import Credentials

from google_auth_oauthlib.flow import InstalledAppFlow

from google.auth.transport.requests import Request

from googleapiclient.discovery import build

import os.path

import pickle

 

# If modifying these SCOPES, delete the file token.pickle.

SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']

 

def get_calendar_service():

    creds = None

    # The file token.pickle stores the user's access and refresh tokens.

    if os.path.exists('token.pickle'):

        with open('token.pickle', 'rb') as token:

            creds = pickle.load(token)

    # If there are no (valid) credentials available, let the user log in.

    if not creds or not creds.valid:

        if creds and creds.expired and creds.refresh_token:

            creds.refresh(Request())

        else:

            flow = InstalledAppFlow.from_client_secrets_file(

#                'credentials.json', SCOPES)

                'client_secret_1017705516251-htpji0uovipunfsnbp1vee1g06hh5feh.apps.googleusercontent.com.json', SCOPES)

            creds = flow.run_local_server(port=0)

        # Save the credentials for the next run

        with open('token.pickle', 'wb') as token:

            pickle.dump(creds, token)

 

    service = build('calendar', 'v3', credentials=creds)

    return service

 

def get_todays_events():

    service = get_calendar_service()

    # Call the Calendar API

    now = datetime.utcnow().isoformat() + 'Z'  # 'Z' indicates UTC time

    print('Getting the upcoming events')

    events_result = service.events().list(calendarId='primary', timeMin=now,

                                          maxResults=30, singleEvents=True,

                                          orderBy='startTime').execute()

    events = events_result.get('items', []) 

 

    if not events:

        print('No upcoming events found.')

        return

 

    # Prints the start and name of the next 10 events

    for event in events:

        start = event['start'].get('dateTime', event['start'].get('date'))

        print(start, event['summary'])

 

if __name__ == '__main__':

    get_todays_events()

Reply