What You'll Build

  • An AI bot that lives inside your Google account
  • Sorts emails into categories you define
  • Sends you a daily digest
  • Can draft replies and auto-archive low-priority mail
  • Runs on autopilot every day

The Gemini API costs pennies per day for this kind of usage — typically under $1/month. Paid email organizer services that do the same thing charge $20/month or more.

Before You Start

  • A Gmail account (personal or Google Workspace)
  • About 15 minutes
  • Willingness to copy and paste
  • Access to any AI chatbot (Claude, Gemini, ChatGPT, etc.)

Step-by-Step Walkthrough

Step 1: Open Google Apps Script

  1. Go to script.google.com and sign in with the Gmail account you want to organize.
  2. Click New project and name it Email Organizer.

Make sure you're signed into the right Google account if you have multiple.

Step 2: Get a Gemini API Key

  1. Go to aistudio.google.com/apikey.
  2. Click Create API key and copy it.
  3. In Apps Script, go to Project Settings > Script Properties > add a property named GEMINI_API_KEY with your key as the value.

Your API key is private. Don't share it or post it publicly.

Step 3: Generate Your Custom Script

  1. Complete the questionnaire below.
  2. Copy the generated prompt.
  3. Paste it into your AI of choice and ask it to generate the Apps Script code.
  4. Copy the code the AI gives you back.

Step 4: Paste the Code

  1. Back in the Apps Script editor, select all the default code and delete it.
  2. Paste the AI-generated code.
  3. Click the save icon.

Step 5: Authorize & Test

  1. Click Run on the main function.
  2. Click Review Permissions, choose your account, and click Allow.
  3. Check your inbox to confirm it worked.

Google will warn you the app isn't verified. This is normal for personal scripts — click Advanced then Go to Email Organizer (unsafe) to proceed.

Step 6: Set Up the Daily Trigger

  1. In the Apps Script sidebar, click Triggers (clock icon), then Add Trigger.
  2. Set it to run the main function on a time-driven timer at your preferred interval.
  3. If you enabled a digest, add a second trigger for the digest function.

You can always come back and change the schedule or re-run the questionnaire to update your prompt.

Customize Your Email Organizer

Answer these questions to generate a personalized AI prompt for your email organizer.

Email Categories
Which categories do you want?
Create a catch-all ‘Other’ label for uncategorized email?
Actions & Automation
What should happen with low-priority emails (newsletters, promotions)?
Draft reply suggestions for which categories?
What tone should draft replies use?
Daily Digest
Send a daily digest email summarizing your inbox?
Schedule & Preferences
How often should the bot run?
Which days should it run?

Frequently Asked Questions

I got a scary Google permissions warning

When you authorize a personal Apps Script project, Google shows an "unverified app" screen. This is standard for any script you write yourself — it simply means Google hasn't reviewed it (and doesn't need to for personal use). Click Advanced, then Go to Email Organizer (unsafe). The "unsafe" label is misleading; the script only accesses your own account with the permissions you grant.

The script ran but nothing happened

First, check the Execution log in Apps Script (View > Execution log) for error messages. The most common cause is a label spelling mismatch — make sure the label names in your script match real Gmail labels exactly, including capitalization. Also confirm the script is looking at recent emails and not an empty time window.

I want to change my categories later

Re-run the questionnaire on this page with your updated preferences, copy the new prompt, paste it into your AI chatbot to generate fresh code, and replace the old code in Apps Script. Your triggers and API key stay the same.

How much will this cost?

The Gemini API offers a generous free tier, and even beyond that, processing a typical inbox costs well under $1/month. You can monitor your usage at Google AI Studio. Compare that to commercial email organizer subscriptions that charge $20/month or more for similar features.

Can I use this with Outlook or Yahoo?

This guide is built specifically for Gmail and Google Apps Script. However, the prompt-based approach works elsewhere: you can take the generated prompt, ask an AI to adapt the code for Outlook (using Office Scripts or Power Automate) or another email provider. The logic and categories transfer — only the platform integration code changes.