Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tutorial_gmail_automation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Gmail Automation

This project is a Python-based utility to connect to Gmail, authenticate using OAuth 2.0, and retrieve emails based on a custom search query. The results are processed and displayed in a Pandas DataFrame. The utility also extracts unique email addresses from senders and email content.

## Features

- OAuth 2.0 authentication using `credentials.json`
- Retrieve emails using Gmail API with custom search queries
- Display email metadata (sender, subject, date, snippet) in a DataFrame
- Extract and list unique email addresses from sender fields and message bodies
- Designed to work inside a Jupyter Notebook environment

---

## Google Cloud Setup

1. Go to [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project (or select an existing one).
3. Enable the **Gmail API** for the project.
4. Navigate to **APIs & Services > Credentials**, click **Create Credentials > OAuth 2.0 Client ID**.
5. Choose **Desktop App** as the application type.
6. Download the `credentials.json` file and place it in the root directory of your project (same folder as the notebook).


## Usage

1. Clone this repository or download the notebook.
2. Make sure `credentials.json` is in the project directory.
3. Open tutorial_gmail_automation.ipynb in Jupyter Notebook and run all cells:
-The first time, you will be prompted to authorize access via a browser.
-Once authenticated, a token.json will be saved for future sessions.
4. Modify the search_query variable inside the notebook to filter emails (e.g., 'subject:invoice', 'after:2024/01/01').
Loading