From d31aa884e3b2a0c25e07c327983ffe501ed1f5db Mon Sep 17 00:00:00 2001 From: Mario Rohana Date: Wed, 6 Aug 2025 19:16:26 +0300 Subject: [PATCH 1/4] feat: add a walkthrough for google sheets events --- .../get_google_sheets_notifications/README.md | 45 +++++++++++++++++++ .../autokitteh.yaml | 17 +++++++ .../program.py | 17 +++++++ 3 files changed, 79 insertions(+) create mode 100644 walkthroughs/get_google_sheets_notifications/README.md create mode 100644 walkthroughs/get_google_sheets_notifications/autokitteh.yaml create mode 100644 walkthroughs/get_google_sheets_notifications/program.py diff --git a/walkthroughs/get_google_sheets_notifications/README.md b/walkthroughs/get_google_sheets_notifications/README.md new file mode 100644 index 00000000..3439b82e --- /dev/null +++ b/walkthroughs/get_google_sheets_notifications/README.md @@ -0,0 +1,45 @@ +--- +title: Google Sheets Notifications +description: detects and responds to changes in Google Sheets documents +integrations: ["googledrive"] +categories: ["Productivity", "Reliability"] +tags: ["google sheets events", "file_monitoring", "notifications"] +--- + +# Google Sheets Notifications + +This project detects when Google Sheets documents are edited and processes those change events. + +This project monitors spreadsheet change by integrating Google Drive to track file modifications and filter for Google Sheets documents specifically. + +API documentation: + +- Google Drive: https://docs.autokitteh.com/integrations/google/drive + +## How It Works + +1. Monitor Google Drive for file change events +2. Filter events to only include Google Sheets documents +3. Process spreadsheet change notifications +4. Log the file ID and change details + +## Cloud Usage + +1. Initialize your connection (Google Drive) +2. Deploy project + +## Trigger Workflow + +> [!IMPORTANT] +> Ensure all connections (Google Drive) are initialized; otherwise, the workflow will raise a `ConnectionInitError`. + +The workflow is triggered via Google Drive when files are modified. The system filters these events to only process changes to Google Sheets documents. + +## Self-Hosted Deployment + +Follow [these detailed instructions](https://docs.autokitteh.com/get_started/deployment) to deploy the project on a self-hosted server. + +## Known Limitations + +- Only change events for files created by or explicitly shared with the app are triggered when using the `drive.file` scope. +- Does not track creation or deletion of spreadsheets diff --git a/walkthroughs/get_google_sheets_notifications/autokitteh.yaml b/walkthroughs/get_google_sheets_notifications/autokitteh.yaml new file mode 100644 index 00000000..b38c0d6e --- /dev/null +++ b/walkthroughs/get_google_sheets_notifications/autokitteh.yaml @@ -0,0 +1,17 @@ +# This YAML file is a declarative manifest that describes +# a project that triggers events when a Google Sheets document is edited. + +version: v1 + +project: + name: gmail + + connections: + - name: drive_conn + integration: googledrive + + triggers: + - name: on_file_change + event_type: file_change + connection: drive_conn + call: program.py:filter_spreadsheet_event diff --git a/walkthroughs/get_google_sheets_notifications/program.py b/walkthroughs/get_google_sheets_notifications/program.py new file mode 100644 index 00000000..dc1a2be7 --- /dev/null +++ b/walkthroughs/get_google_sheets_notifications/program.py @@ -0,0 +1,17 @@ +"""walkthrough on how to get notifications a spreadsheet is edited.""" + + +def filter_spreadsheet_event(event): + """Filter events to only those related to spreadsheet changes.""" + print(event) + file_type = event.data.get("file", {}).get("mime_type") + if file_type != "application/vnd.google-apps.spreadsheet": + return + on_spreadsheet_change(event) + + +def on_spreadsheet_change(event): + """Handle the event when a spreadsheet is edited.""" + file_id = event.data.get("file", {}).get("id") + print(f"spread sheet with the ID ({file_id}) ") + print("was edited") From 7ee0ff591288633b71eea0a7d10ff8c676153ea7 Mon Sep 17 00:00:00 2001 From: Mario Rohana Date: Wed, 6 Aug 2025 19:19:12 +0300 Subject: [PATCH 2/4] readme fix --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index adaa72d7..d42d8244 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ demonstrate basic system features, integration APIs, and best practices. | [Google Sheets to SOAP Calculator](./sheets_to_soap/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=sheets_to_soap) | Reads numeric values from Google Sheets and sends them to a SOAP-based calculator API | googlesheets | | [AI-driven Slack bot for assistance requests](./slack_support/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=slack_support) | Automatically route help requests to the right expert based on topic analysis and expertise matching | slack, googlesheets, googlegemini | | [Fault tolerant workflow with manual Slack approvals](./task_chain/single_workflow/basic/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=task_chain/single_workflow/basic) | Runs a sequence of tasks with fault tolerance. In case of failure, user can decide to terminate or retry from the point of failure. | slack | +| [Google Sheets Notifications](./walkthroughs/get_google_sheets_notifications/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=walkthroughs/get_google_sheets_notifications) | detects and responds to changes in Google Sheets documents | googledrive | | [Gmail new email notification](./walkthroughs/new_gmail_notification/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=walkthroughs/new_gmail_notification) | Poll for new emails in Gmail inbox and handle them with custom logic | gmail | | [Create Jira ticket from webhook data](./webhook_to_jira/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=webhook_to_jira) | Create Jira issues automatically from HTTP webhooks | jira | | [WhatsApp ChatGPT Bot](./whatsapp_chatbot/)
[![Start with AutoKitteh](https://autokitteh.com/assets/autokitteh-badge.svg)](https://app.autokitteh.cloud/template?name=whatsapp_chatbot) | WhatsApp chatbot that responds to messages using ChatGPT intelligence | twilio, chatgpt | From d63821a0615e5a5e94e13b87f01c6bb9287920ba Mon Sep 17 00:00:00 2001 From: Mario Rohana <104531719+mario99logic@users.noreply.github.com> Date: Wed, 6 Aug 2025 19:19:43 +0300 Subject: [PATCH 3/4] Update walkthroughs/get_google_sheets_notifications/program.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- walkthroughs/get_google_sheets_notifications/program.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/walkthroughs/get_google_sheets_notifications/program.py b/walkthroughs/get_google_sheets_notifications/program.py index dc1a2be7..bdaa2f87 100644 --- a/walkthroughs/get_google_sheets_notifications/program.py +++ b/walkthroughs/get_google_sheets_notifications/program.py @@ -13,5 +13,5 @@ def filter_spreadsheet_event(event): def on_spreadsheet_change(event): """Handle the event when a spreadsheet is edited.""" file_id = event.data.get("file", {}).get("id") - print(f"spread sheet with the ID ({file_id}) ") + print(f"spreadsheet with the ID ({file_id}) ") print("was edited") From 8d109ecadf00eaff65de4f4391341616da303b2f Mon Sep 17 00:00:00 2001 From: Mario Rohana Date: Thu, 7 Aug 2025 13:11:33 +0300 Subject: [PATCH 4/4] fixes --- walkthroughs/get_google_sheets_notifications/README.md | 6 ++---- .../get_google_sheets_notifications/autokitteh.yaml | 3 ++- walkthroughs/get_google_sheets_notifications/program.py | 9 --------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/walkthroughs/get_google_sheets_notifications/README.md b/walkthroughs/get_google_sheets_notifications/README.md index 3439b82e..d61d2cea 100644 --- a/walkthroughs/get_google_sheets_notifications/README.md +++ b/walkthroughs/get_google_sheets_notifications/README.md @@ -18,10 +18,8 @@ API documentation: ## How It Works -1. Monitor Google Drive for file change events -2. Filter events to only include Google Sheets documents -3. Process spreadsheet change notifications -4. Log the file ID and change details +1. Monitor Google Drive for a spread sheet change events +2. Log the file ID and change details ## Cloud Usage diff --git a/walkthroughs/get_google_sheets_notifications/autokitteh.yaml b/walkthroughs/get_google_sheets_notifications/autokitteh.yaml index b38c0d6e..ceb8b912 100644 --- a/walkthroughs/get_google_sheets_notifications/autokitteh.yaml +++ b/walkthroughs/get_google_sheets_notifications/autokitteh.yaml @@ -14,4 +14,5 @@ project: - name: on_file_change event_type: file_change connection: drive_conn - call: program.py:filter_spreadsheet_event + call: program.py:on_spreadsheet_change + filter: data.file.mime_type == 'application/vnd.google-apps.spreadsheet' diff --git a/walkthroughs/get_google_sheets_notifications/program.py b/walkthroughs/get_google_sheets_notifications/program.py index bdaa2f87..8dc7964d 100644 --- a/walkthroughs/get_google_sheets_notifications/program.py +++ b/walkthroughs/get_google_sheets_notifications/program.py @@ -1,15 +1,6 @@ """walkthrough on how to get notifications a spreadsheet is edited.""" -def filter_spreadsheet_event(event): - """Filter events to only those related to spreadsheet changes.""" - print(event) - file_type = event.data.get("file", {}).get("mime_type") - if file_type != "application/vnd.google-apps.spreadsheet": - return - on_spreadsheet_change(event) - - def on_spreadsheet_change(event): """Handle the event when a spreadsheet is edited.""" file_id = event.data.get("file", {}).get("id")