8000 GitHub - TFMV/MailDuck: Extract your Gmail Messages to DuckDB for Analysis
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

TFMV/MailDuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MailDuck 🦆📨

Extract Gmail messages into DuckDB for easy querying & analysis

Installation

  1. Clone this repository: git clone https://github.com/TFMV/MailDuck.git.
  2. Install the requirements: pip install -r requirements.txt
  3. Create a Google Cloud project here.
  4. Open Gmail in API & Services and activate the Gmail API.
  5. Open the OAuth consent screen and create a new consent screen. You only need to provide a name and contact data.
  6. Next open Create OAuth client ID and create credentials for a Desktop app. Download the credentials file and save it under credentials.json in the root of this repository.

Here is a detailed guide on how to create the credentials: https://developers.google.com/gmail/api/quickstart/python#set_up_your_environment.

Usage

Sync all emails

  1. Run the script: python main.py sync --data-dir path/to/your/data where --<data-dir> is the path where all data is stored. This creates a DuckDB database in <data-dir>/messages.db and stores the user credentials under <data-dir>/credentials.json.
  2. After the script has finished, you can query the database using, for example, the duckdb command line tool: duckdb <data-dir>/messages.db.
  3. You can run the script again to sync all new messages. Provide --full-sync to force a full sync. However, this will only update the read status, the labels, and the last indexed timestamp for existing messages.

Sync a single message

python main.py sync-message --data-dir path/to/your/data --message-id <message-id>

Commandline parameters

  • --data-dir: Path to the directory where the data is stored.
  • --full-sync: Force a full sync of all messages.
  • --message-id: The ID of the message to sync.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

About

Extract your Gmail Messages to DuckDB for Analysis

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0