On filtering financial transactions & statements into a secondary account

Well, why would anyone want to do that?

Services like INDmoney and Cred often analyze and parse emails such as these to give customers insights into their spending or hidden fees in their statements. To consciously give access to these services to your primary email account creates doubt in anyone’s head hence…

The secondary email account

A secondary email account can be created that is forwarded a subset of the email from the primary account to do whatever the app wants to do.

Later, this account’s access can be provided to apps for parsing credit card statements and financial transactions. Let’s talk about to go about it,

  1. You can create filters for your email, auto-forward them to the secondary account
  2. You can write a script to automate it all.

The filters

Creating filters in your email account should be straightforward. I use Gmail as my email provider and here’s a guide on how to create an email filter. After the filter is created, you can forward the filtered emails to the secondary account.

Easy way to filter credit card statements is to track your bank email addresses and filter the emails having attachments. Below is an excerpt of my Gmail filters for this usecase in XML. These can be exported and imported right from Gmail.

<feed>
<title>Mail Filters</title>
<id>
tag:mail.google.com,2008:filters:
</id>
<updated>2022-02-17T20:31:44Z</updated>
<author>
<name>Vipul Gupta</name>
<email>[email protected]</email>
</author>
<entry>
<category term="filter"/>
<title>Mail Filter</title>
<id>
tag:mail.google.com,2008:filter:
</id>
<updated>2022-02-17T20:31:44Z</updated>
<content/>
<apps:property name="from" value="[email protected]"/>
<apps:property name="hasAttachment" value="true"/>
<apps:property name="forwardTo" value="[email protected]"/>
<apps:property name="smartLabelToApply" value="^smartlabel_personal"/>
<apps:property name="sizeOperator" value="s_sl"/>
<apps:property name="sizeUnit" value="s_smb"/>
</entry>
<entry>
<category term="filter"/>
<title>Mail Filter</title>
<id>
tag:mail.google.com,2008:filter:
</id>
<updated>2022-02-17T20:31:44Z</updated>
<content/>
<apps:property name="from" value="[email protected]"/>
<apps:property name="hasAttachment" value="true"/>
<apps:property name="forwardTo" value="[email protected]"/>
<apps:property name="smartLabelToApply" value="^smartlabel_personal"/>
<apps:property name="sizeOperator" value="s_sl"/>
<apps:property name="sizeUnit" value="s_smb"/>
</entry>
</feed>

These are emails from just 2 banks. You can create filters more complex for any number of transactions from here.

Can we automate this?

This took me a few clicks and reading along, so I didn’t bother to automate it but there seems to be a way using Google Apps script.

Google Apps Script provides a method of automating many operations on a Gmail account (sending email, searching, labeling, etc.) via the GmailApp class. This is also the way one can sort and filter emails that are based on certain criteria. Someone created a project to use it to filter their Gitlab emails and it’s brilliantly well documented. Check it out: Github project link.

That should do it.

That’s about it, live in the mix, folks.

Leave a Reply

Your email address will not be published. Required fields are marked *