Forget about spending time to save and organize your bills, an AI based workflow will do it for you! This workflow read your bill related email, identify where the PDF bill is stored (it doesn't matter if attached to the email, linked in the email body or in a personal area website), extract main info (like the amount, reference period, etc)  and save the PDF and also structured bill's data in a shared folder.
It uses n8n, Open AI, REST API and almost no programming.
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.

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.
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:

Define a filter for each label:

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.
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:
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.
Trigger
Fetch Unread Emails
Loop Over Items
Convert PDF to JSON
Create subfolder
/nas/<supplier_name>/2024/).
mkdir -p /nas/<supplier_name>/{{ $json.message.content.emission_date.substring(0,4) }}<supplier_name> will change for each case/nas is a remote folder previously mounted in the n8n server with one subfolder for each supplier already createdMark Email as Read
This is the automation I use with Wind mobile and internet provider; the flow:
In addition to the common part:
Fetch Unread Emails (Get unread Wind messages)
Extract Bill Details (Retrieve info)
tel_num).bill_number).emission_date).start_date and end_date).Here is the prompt I used; I specified the name of the fields and the date format in order to have an output consistent and equal between each run:
extract from {{ $json.text }} the telephone number (tel_num), the bill number (bill_number), the emission date (emission_date) and the reference period (start_date, end_date). 
All the dates in ISO format and all the properties must be at root level.
Organize and Save PDF (Save PDF to NAS share)
/nas/Wind/2023/2023-12-24 - 123456789 - 1234567890.pdfThis 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.

This is the automation I use with Acegas, local water supplier; the flow:
In addition to the common part:
Fetch Unread Emails (Gmail)
Extract 'Area Riservata' Link (Retrieve 'area riservata' link)
Ensures that only the relevant PDF download link is returned for further processing.
Here is the prompt I used, really really simple:
select the "Visualizza il documento" link in  {{ $json.html }} and return just the link 
Download HTML Page (Get html page)
Format Date (Date & Time)
CreationDate).yyyy-MM-dd) for naming and organizing the files.Merge Metadata with PDF (Merge Info with PDF)
Save PDF to NAS (Save PDF to NAS share)
/nas/Acegas/2023/2023-12-24.pdfThanks 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:
In addition to the common part:
Extract 'Area Riservata' Link (Retrieve 'area riservata' link)
Uses OpenAI's GPT-3.5-Turbo to extract a specific link starting with https://interattiva.eniplenitude.com from the email content.
Like the previous case, the prompt is really relly simple:
select the link in  {{ $json.html }} that starts with "https://interattiva.eniplenitude.com" 
Retrieve HTML Page (Get html page)
Extract PDF Link (Retrive PDF link)
GPT-4O-MINI, since the 3.5-TURBO, used for all the other AI interactions, is not sufficient to elaborate all the data of the web page. 
get pdf link from  {{ $json.data }}Download and Process PDF (Get PDF content & Convert PDF to JSON)
Extract Detailed Bill Information (Retrieve info)
total_amount).start_date and end_date).Here is the prompt I used; Like in the first case I specified the name of the fields and the date format in order to have an output consistent and equal between each run. In this case :
extract from {{ $json.text }} the total amount (total_amount), 
the reference period (reference_period.start_date and reference_period.end_date), 
the amount of the "Conteggio luce" (electricity_usage.total_cost and electricity_usage.consumption) and 
"Conteggio gas" (gas_usage.total_cost and gas_usage.consumption), 
the bill number (bill_number) and 
the emission date in both natural (emission_date) and ISO format (emission_date_ISO) and year (year). 
All the properties must be at root level.
Save PDF and JSON to NAS (Save PDF to NAS share, Save JSON to NAS share and Convert JSON to binary)
/nas/Eni/{year}/{emission_date_ISO} {bill_number}.pdfConvert JSON to binary step).
Here is an example of the json generated (you can improve it by filtering also the message part):
[{
"index":0,
"message":{
"role":"assistant",
"content":{
  "total_amount":205.34,
  "reference_period":{
    "start_date":"2024-05-01",
    "end_date":"2024-05-31"
  },
  "electricity_usage":{
    "total_cost":181.49,
    "consumption":194
  },
  "gas_usage":{
    "total_cost":16.85,
    "consumption":6
  },
  "bill_number":"M246287450",
  "emission_date":"18.06.2024",
  "emission_date_ISO":"2024-06-18",
  "year":2024,
  "pdf_link":"https://interattiva.eniplenitude.com/55af7b8a6a5746ebb4da541e51d0e9b2"
},
"refusal":null},
"logprobs":null,
"finish_reason":"stop"
}]This is how appears the NAS folder with all the bills extracted and organized by this flow, with both PDF and JSON files.

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.
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."
Even if I'll try to keep all this pages updated, products change over time, technologies evolve... so some use cases may no longer be necessary, some syntax may change, some technologies or products may no longer be available. Remember to make a backup before modifying configuration files and consult the official documentation if any concept is unclear or unfamiliar. 
Use this guide under your own responsibility.
This work and all the contents of this website are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0).
You can distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only by giving credit to the creator. Modified or adapted material must be licensed under identical terms.
You can find the full license terms here