Gmail Subscription Finder: find every paid subscription in your receipts
$7
Gmail Subscription Finder is a small Python tool that reads the receipt emails in your own Gmail and tells you what you're subscribed to and what it costs. Each run it: Logs every charge from...
Read full descriptionDescription
Gmail Subscription Finder is a small Python tool that reads the receipt emails in your own Gmail and tells you what you're subscribed to and what it costs.
Each run it:
- Logs every charge from receipt and invoice emails to a CSV (merchant, amount, currency, date)
- Detects subscriptions: repeated charges of about the same amount spaced a month or a year apart, or receipts that state "/month" or "billed annually"
- Estimates the next renewal, using the date printed in the receipt when there is one
- Writes a report (
subscriptions.md+subscriptions.csv) with monthly and yearly totals - Flags changes: new subscriptions, price increases, and "overdue" renewals that may mean something was cancelled
Subscriptions detected: 6
Streamly $15.99 monthly next May 5, 2030 active [4 charges ~31 days apart]
CloudVault $99.00 yearly next Mar 3, 2031 active [cadence stated in receipt]
Acme Fitness $39.00 monthly due Mar 2, 2030 overdue [2 charges ~31 days apart]
Total (USD): $47.23/month, $566.76/year(sample output, synthetic data)
Privacy first
- Uses Google's read-only Gmail permission (
gmail.readonly) with your own OAuth client. It cannot send, delete, or label mail. - Runs entirely on your computer. Results are plain files you control.
- Never pays, cancels, or touches any bank, card, or store account.
Features
- Handles
$,€,£,CA$,A$, ISO currency codes, and1.234,56style amounts - Reads plain-text and HTML receipts; prefers the real total over subtotals and line items
- Ignores refunds, failed payments, renewal reminders, and $0 trials; counts a receipt + invoice pair once
- Rerun-safe: emails are never downloaded twice, rows are keyed by merchant, and your own notes column is kept
--dry-run,--days,--max-messages,--out-dir,--no-discord- Optional Discord summary when something changes
- About 900 lines of readable Python, 3 dependencies, 80 offline tests
Requirements
- Python 3.9+ on macOS, Linux, or Windows
- A Gmail or Google Workspace account
- A free Google Cloud project for your own OAuth client (step-by-step guide included, about 10 minutes)
Limitations
It works from receipt emails, so it misses charges that never send one (or send it to another address), and unusual receipt layouts can be misread. Your bank statement is still the full record.
Not affiliated with or endorsed by Google. Gmail is a trademark of Google LLC.
Files included
gmail-subscription-findergmail-subscription-finder
gmail_subscription_findergmail_subscription_finder
- parse.pyparse.py11.4 KB
- report.pyreport.py6.6 KB
- __main__.py__main__.py6.2 KB
- recurrence.pyrecurrence.py5.2 KB
- gmail.pygmail.py3.4 KB
- config.pyconfig.py2.8 KB
- notify.pynotify.py876 B
- __init__.py__init__.py106 B
- README.mdREADME.md10.3 KB
teststests
- test_report_and_cli.pytest_report_and_cli.py9.3 KB
- test_parse.pytest_parse.py7.3 KB
- test_recurrence.pytest_recurrence.py3.7 KB
- conftest.pyconftest.py2.7 KB
- CHANGELOG.mdCHANGELOG.md986 B
- config.example.jsonconfig.example.json305 B
- .gitignore.gitignore77 B
- requirements.txtrequirements.txt59 B
README
gmail-subscription-finder/README.md
Gmail Subscription Finder
Scans the receipt emails in your own Gmail, logs every charge to a CSV, and works out which ones are subscriptions: what each costs, whether it bills monthly or yearly, and when the next renewal is expected. The result is a Markdown report and a CSV you can open in any spreadsheet.
It runs on your computer, reads Gmail with a read-only permission, and never pays, cancels, sends, or changes anything.
What you get
$ python -m gmail_subscription_finder
Listed 16 receipt-like emails; 16 new, 16 new charges; 16 charges logged in total
Subscriptions detected: 6
Streamly $15.99 monthly next May 5, 2030 active [4 charges ~31 days apart]
Pixelforge $12.00 monthly next May 9, 2030 active [3 charges ~30 days apart]
Tunebox $10.99 monthly next May 18, 2030 active [4 charges ~31 days apart]
Daily Ledger News €8.99 monthly next May 11, 2030 active [cadence stated in receipt]
CloudVault $99.00 yearly next Mar 3, 2031 active [cadence stated in receipt]
Acme Fitness $39.00 monthly due Mar 2, 2030 overdue [2 charges ~31 days apart]
Total (USD): $47.23/month, $566.76/year
Total (EUR): €8.99/month, €107.88/yearAnd in subscriptions.md:
| Merchant | Amount | Cadence | Last charge | Next expected | Status | Basis |
|---|---|---|---|---|---|---|
| Streamly | $15.99 | Monthly | Apr 5, 2030 | May 5, 2030 | active | 4 charges ~31 days apart |
| CloudVault | $99.00 | Yearly | Mar 3, 2030 | Mar 3, 2031 | active | cadence stated in receipt |
| Acme Fitness | $39.00 | Monthly | Feb 2, 2030 | Mar 2, 2030 | overdue | 2 charges ~31 days apart |
(Sample output from synthetic data.)
How a subscription is recognized. A merchant counts as recurring when it has two or more charges of about the same amount (within 10%) spaced about a month (26-35 days) or a year (350-380 days) apart, or when its latest receipt states the cadence ("$9.99/month", "billed annually"). If a receipt states the next renewal date, that date is used.
Features
- Amounts in
$,US$,CA$,A$,€,£,¥,₹, or ISO codes (49.00 CHF), with1,234.56and1.234,56number styles. Labelled totals ("Amount paid", "Total") win over subtotals and line items. - Plain-text and HTML receipts. Style sheets, scripts, and attachments are ignored.
- Refunds, failed payments, "your plan renews soon" reminders, and $0 trials are not counted.
- A charge emailed twice (receipt plus invoice) counts once.
- overdue status when an expected renewal passed with no receipt, which often means it was cancelled (or the receipt now goes to another address).
- Price changes, new subscriptions, and ones that stopped matching are listed after each run.
--dry-runshows everything without writing a file or sending anything.- Optional Discord summary when something changes.
- Small: about 900 lines of readable Python, three dependencies, 70+ offline tests.
Requirements
- Python 3.9+ on macOS, Linux, or Windows
- A Gmail or Google Workspace account
- A free Google Cloud project (step 2 walks through it, about 10 minutes)
Setup
1. Install
pip install -r requirements.txtA config file is optional. To change defaults, copy config.example.json to config.json
(in this folder, or in ~/.config/gmail-subscription-finder/).
2. Create your own Google OAuth client (one time; Google requires each user to have one)
- Go to https://console.cloud.google.com/ and create a project (any name).
- Go to APIs & Services → Library, search for Gmail API, and click Enable.
- Go to APIs & Services → OAuth consent screen (called Google Auth Platform in newer
consoles). Choose External, enter an app name and your email, and add your own Gmail
address as a test user. When asked for scopes you can skip it; the tool requests
gmail.readonlyitself. - Go to Credentials → Create credentials → OAuth client ID, choose Desktop app, then Download JSON.
- Save the file as
~/.config/gmail-subscription-finder/client_secret.json(or setcredentials_fileinconfig.json). - Optional, for scheduled runs: click Publish app on the consent screen page. Apps left in "Testing" have their sign-in expire after 7 days. You don't need Google's verification for your own use. You'll see an "unverified app" warning once; that's your own app.
3. Sign in once
python -m gmail_subscription_finder --authA browser opens and asks you to allow read-only Gmail access. The token is saved to
~/.config/gmail-subscription-finder/token.json with owner-only permissions.
4. Preview, then run
python -m gmail_subscription_finder --dry-run
python -m gmail_subscription_finderThe first run downloads every receipt-like email in the lookback window, so it can take a few minutes. Later runs only download emails they haven't seen.
Usage
| Flag | What it does |
|---|---|
--auth | One-time Google sign-in (opens a browser), then exit. |
--dry-run | Scan and print results. Writes no files and sends nothing. |
--days N | Gmail lookback window. Default 400, so yearly renewals can be seen twice. |
--max-messages N | Cap on receipt-like emails listed per run. Default 1000. |
--out-dir DIR | Where output files go. Default ~/subscription-report. |
--no-discord | Skip the Discord summary for this run. |
--config PATH | Use a specific config file. |
Output files (in the out-dir):
transactions.csv: one row per receipt email, deduped by Gmail message ID. Non-charges are logged asskippedso they aren't downloaded again. Delete this file to rescan from scratch.subscriptions.csv: one row per merchant. Rerunning updates rows in place. Anotescolumn you fill in yourself is kept across runs. Merchants that stop matching stay in the file, markednot detected, instead of disappearing.subscriptions.md: the readable report.
Files are written atomically, so an interrupted run never leaves a half-written report.
Config keys (config.json, all optional):
| Key | Default | What it does |
|---|---|---|
days, max_messages, out_dir | 400, 1000, ~/subscription-report | Same as the flags. Flags win. |
default_currency | USD | Currency assumed for a bare $ amount (set CAD, AUD, ...). |
ignore_merchants | venmo, zelle, cash app | Text in a merchant name. Logged as ignored, never counted. |
merchant_aliases | {} | {"text in name": "Name"} to merge variants, e.g. a plan name in the subject. |
extra_query | Added to the Gmail search, e.g. -from:shop@example.com. | |
discord_webhook_url | Optional. Env DISCORD_WEBHOOK_URL takes priority. | |
discord_send_when_empty | false | Post a summary even when nothing changed. |
credentials_file, token_file | ~/.config/gmail-subscription-finder/ | OAuth file locations. |
Discord summary (optional). In Discord, open Server Settings → Integrations → Webhooks →
New Webhook, pick a channel, and copy the URL into DISCORD_WEBHOOK_URL or
discord_webhook_url. A short summary (new subscriptions, price changes, monthly total) is
posted only when something changed. Leave it empty and nothing is sent.
Run it on a schedule (cron, weekly on Monday at 8 AM):
0 8 * * 1 cd /path/to/gmail-subscription-finder && /usr/bin/python3 -m gmail_subscription_finder >> finder.log 2>&1On Windows, create a Task Scheduler task that runs python -m gmail_subscription_finder in
this folder. Exit code 1 means some emails couldn't be read; 2 means a config error.
Privacy
- Read-only. The only Google permission requested is
gmail.readonly. The tool callsmessages.listandmessages.getand nothing else. It cannot send, delete, or label mail. - Local. Emails are parsed on your machine. Results go to files you choose. Nothing is sent anywhere except Google's own API and, if you turn it on, your Discord webhook (which receives merchant names and amounts only).
- No money actions. It never pays, cancels, or touches any bank, card, or store account.
- Your OAuth client and token stay on your computer. To revoke access, delete
token.jsonand remove the app at https://myaccount.google.com/permissions.
Limitations
- It relies on receipt-email heuristics. Unusual receipt layouts can produce a wrong
amount or merchant name. Use
--dry-runand thetransactions.csvlog to check, andmerchant_aliasesto merge names. - It misses charges that send no email, or whose receipt goes to a different address, an app store account you don't check, or a paper statement. Your bank or card statement is still the full record.
- A new subscription needs either two charges or a receipt that states the cadence before it is detected. A yearly plan billed once with no cadence wording won't show up until the second year.
- Only monthly and yearly cadences are detected (not weekly or quarterly).
- Next-renewal dates are estimates from past charges unless the receipt states one.
- Gmail's own search decides which emails are scanned (receipts, invoices, the Purchases category). Mail filed into Promotions or Social is skipped on purpose.
Troubleshooting
- "Gmail is not authorized yet": run
--authonce in a terminal. - "Missing ... client_secret.json": redo step 2 and check the file path.
- Sign-in stops working after a week: the consent screen is still in "Testing". Publish it
(step 2.6), delete
token.json, and run--authagain. Gmail API 403about the API being disabled: enable the Gmail API in the same Google Cloud project as your OAuth client.- A merchant appears under two names: add a
merchant_aliasesentry. - Nothing found: try
--days 730, and check that your receipts are in Gmail (not only in a store app).
Tests
pip install pytest && python -m pytest testsThe tests use synthetic emails and a mocked Gmail API. No Google account is needed.
Disclaimer
Provided "as is", without warranty of any kind. Results are estimates based on emails and can be incomplete or wrong. Check your bank or card statements before making financial decisions. You run it with your own Google credentials and are responsible for its use on your account.
Not affiliated with or endorsed by Google. Gmail is a trademark of Google LLC.
Reviews
No reviews