I hate recurring manual tasks… I consider them a waste of time, and whenever possible, I try to automate them as much as I can; that way, I can invest that time in something more productive and interesting. One of these tasks is undoubtedly filing the various utility bills each month: I always use direct debit and opt for digital billing, which makes the environment happier by saving paper and saves me from having to manually scan paper documents. The problem is that every month, when I receive the email notification about a new bill, I have to:

With this trick, I have completely automated the entire process… so I have the emails neatly organized in their folder whenever I need them. Additionally, if necessary, the main information is automatically extracted, allowing it to be saved in an Excel sheet or used in another process/software/tool that requires raw data for monitoring consumption and/or expenses.

Step 1: Organize e-mails

This is an optional step but I recommend following it to simplify the process later. I use Gmail as my main email address, so I simply defined different labels to mark all the bills I want to manage. Below you can find the instructions to configure Gmail as I did but the process may differ for other e-mail providers.

  1. Create a label for each service provider You can do it directly from the left-hand sidebar or by the all settings menu by clicking the gear icon in the top-right corner of Gmail web interface. If you want to nest this label under an existing one, check the box “Nest label under” and choose the parent label. This is the label structure for my service providers:

Label structure

  1. Define a filter for each label:
    • Click on the gear icon in the top-right corner of Gmail and select “See all settings”.
    • Go to the “Filters and Blocked Addresses” tab.
    • Click “Create a new filter”.
    • A dialog box will appear where you can define the criteria for the filter, for example filtering by sender email address or domain, keywords in the subject line, specific words in the email body, and so on…
    • Choose the best filter for your specific needs: it may vary between two different providers, but usually sender and/or subject does the job well.
    • Choose what happens to emails matching the criteria: in this case we want to apply the label just defined
    • Apply the filter also to existing emails, by checking the box “Also apply filter to matching conversations”.

Label filter

  1. Check the filters If everything worked, you will find all the emails with invoices under the label corresponding to each supplier. If not, check the filter configuration.
    Make sure the emails to be processed are marked as “unread,” as this will be necessary for setting up the next step.


Step 2: Set-Up Open AI API

We will use a GPT LLM for parsing e-mails, personal area websites and also PDFs. In this way, we are not tied to the format of the email/website/pdf, and if it changes in the future, we would only need to make minimal adjustments, if any, since the AI will always interpret the text to identify the parts we are interested in, based on our instructions. I used Open AI GPT models but you can choose other AI LLMs: regardless of which LLM you use, to use it from another software, like n8n, it is necessary to use the exposed APIs and to do so, an authorised token must be defined. These are the steps to create it with OpenAI:

1. Create an OpenAI Account

2. Access the API Dashboard

3. Generate an API Key

4. Store the API Key Securely

5. Monitor Usage and Billing

  1. Monitor API Usage: OpenAI provides detailed usage analytics on your dashboard. You can monitor the number of tokens you’ve used and manage your spending.
  2. Manage Quotas: If needed, you can set limits or alerts for your API usage to avoid unexpected charges.


Step 3: Create the automation flow

For this process, I used n8n: n8n is an open-source workflow automation tool that allows you to connect various applications and services to automate repetitive tasks without manual intervention. It provides a visual interface where you can design workflows by linking different nodes that represent actions, triggers, or data processing steps.

I installed it in a Proxmox LXC by using the helper script provided by Community-Scripts: this is a very useful Community with many script that will help you many times: if you like them, consider donating to support Angie, tteckster’s wife - the founder and best supporter of the community - too early passed away.

I created three different workflows for three different suppliers; each one uses a unique approach and applies different solutions, based on my needs as well as to provide various ideas for study and exploration.

Of course, your needs might differ, as well as the structure of the emails from your suppliers. However, you can draw inspiration from the three workflows and the solutions implemented to build one that best suits your requirements and adapts to your specific case.

  1. Bill included as an email attachment: the simpliest case ☺️: the attachment will be renamed and saved to a shared folder. But to make it more interesting, it processes all unread email and extracts and organizes relevant details (e.g., bill number, dates, and phone number) from the attached PDF.
  2. Bill downloadable via a link contained in the email body: in this case we don’t need to retrieve additional information from the PDF. The attachment will be renamed and saved to a shared folder; the difference from the previous case lies in the method of retrieving the PDF, by parsing the email content to extract the link of the PDF. Unlike the other workflows, this one processes just a single email, since the link provided has an expiration date and for older emails it doesn’t work.
  3. Bill downloadable via a link from the personal area, which is accessible through a link contained in the email body : this is the most complete case that groups all the solutions used by the previous ones, including the extraction of key information, which this time will be also saved in a JSON file for further applications.

Workflow description: nodes common to each solution


1. Bill included as an email attachment


This is the automation I use with Wind mobile and internet provider; the flow:

  1. Processes unread emails containing Wind bills.
  2. Extracts and organizes relevant details (e.g., bill number, dates, and phone number) from the attached PDF.
  3. Saves the processed PDF to a network drive (NAS) with a structured naming convention and directory organization.
  4. Marks the email as read to avoid reprocessing.

Workflow description

In addition to the common part:


This is how appears the NAS folder with all the bills extracted and organized by this flow. In my case this is not the target destination but a scheduled task move the bills from the network share to mi iCloud document folder.

folder structure wind



This is the automation I use with Acegas, local water supplier; the flow:

  1. Processes last unread emails containing Acegas bills. As I said before, the link to download the bill has an expiration date: it is no longer accessible once the next bill becomes available, so reading the latest one is sufficient.
  2. Doesn’t extract any data but it still uses AI to intelligently parse email content and locate the precise link for downloading the bill.
  3. Saves the processed PDF to a network drive (NAS) with a structured naming convention and directory organization.
  4. Marks the email as read to avoid reprocessing.

Workflow description

In addition to the common part:

Margin Notes

Thanks to AI, this automation is truly simple… without it, I would have had to analyze the document model of the email to identify the correct tag with the link… and redo everything if the format, layout, or structure of the email were to change.



This is the automation I use with Eni, a big Italian gas and electricity supplier; the flow:

  1. Fetches unread email messages with Eni label.
  2. Extracts a PDF link from the email content.
  3. Downloads and processes the PDF to extract structured data.
  4. Saves the processed PDF to a network drive (NAS) with organized filenames and directories.
  5. Marks the processed email as read to avoid reprocessing.

Workflow description

In addition to the common part:


This is how appears the NAS folder with all the bills extracted and organized by this flow, with both PDF and JSON files.

folder structure eni



Step 4: Think how to use all your saved time

You don’t have to worry about bills anymore… forgot them! Your bank takes care of the payments, while AI saves your invoices, organizes them for you, and extracts the key information. You have plenty of extra time to focus on what matters most or brings you satisfaction.



Step 5: Possible additional extensions:

  1. Disable email notifications and instead configure a notification to receive structured data with amounts, consumption, and other relevant details.
  2. Leverage AI to extract additional important information from the bill, such as contract changes, price increases, or other details, and include them in the notifications.”


Step 6: Enjoy

If this trick has been useful to you, keep scrolling down and consider supporting me by clicking that beautiful blue button! 😅