Combine Email Bills Using Gmail API

Jan 07, 2021 - 2 min read

I wanted to automate combining monthly bills to share it with your roommates so I created this script. Let me know what you guys think!

Preview from GitHub

Customizable and extensible way of collecting all your bills before sending out an email with a final receipt to your recipients.

From emails in your inbox: Inbox Emails

To sending out: Composed Email

How It Works

General idea:

  1. Fetches Gmails with the labels you provided.
  2. Runs each email through the scripts (that you provide) to parse the amount. This includes reading and attaching files!
  3. Adds any additional custom scripts that you may have.
  4. Finally, composes an email using the parsed data to create a “final” receipt to send to your recipients.

An example of how I use it:

  1. I get utility bills on my primary email account.
  2. Forward them to my dev email account. This is to limit what emails you can access using Google API for safety.
  3. Create filters to label my utility bills by water and electricity.
  4. Write email scripts to extract the amount.
  5. Download code on my raspbery pi and schedule it to run every month to send me monthly aggregated bills 🎉.

Check out the GitHub repository for a more extensive writeup.