Skip to content
Efficiency AI in Finance Financial Close

An AI Agent That Does Month-End Autonomously? Here’s How I Built One to Prove It’s Possible

Dimitri Aroney
Dimitri Aroney |

Month-end is full of spreadsheets no one enjoys maintaining. But what if an AI agent could handle them for you?

I set out to test that idea by building one. The goal: take a routine month-end process (prepayments), and automate it from invoice to month-end journal entry, without a single human processing an invoice, creating a workpaper, or posting a journal.  

It worked! The agent processed prepayments from invoice to journal entry without human help (though I did throw in a sign-off step for realism and a touch of professional courtesy).  

This could reshape how finance teams close the books and how software vendors help finance teams close the books.

 

Why this Matters

Month-end isn't broken. But it's far from efficient.

Most finance teams still rely on spreadsheets, manual journals, and routine checks that haven’t evolved in decades. Even so-called “automation” often just automates a part of the processes leaving significant steps for people to handle manually.  

Prepayments were the test case. But they represent something bigger: a class of repeatable, spreadsheet-driven tasks that could be handled by intelligent agents,  not people.

If AI can manage the full prepayment workflow, it can handle accruals, lease journals, revenue adjustments, and more. By handling repeatable processes, AI gives accountants more time for the work that actually needs their expertise.

This is what it looks like when AI becomes part of the finance team.

What was built

The goal was simple: replace the entire prepayments process with an AI Agent! 

At the heart of this AI agent is n8n, acting as the orchestration layer, connecting AI, spreadsheets, scripts, and the accounting system into a single, autonomous repeatable workflow.

It’s a modular system built from off-the-shelf tools:

  • n8n handles the flow logic, triggers, approvals, and data movement.
  • OpenAI interprets text from invoice PDFs and transactional data out of the ERP.
  • Google Sheets & Google Apps Script handle calculations and journal generation and summarises the information for human review.
  • Xero’s API to get and post invoices and post manual journals. 

Each step is lightweight, flexible, and composable, which means the same design could be extended to handle accruals, revenue journals, or any other spreadsheet-driven task.

It’s not just automation, it’s a prototype for how finance workflows could be re-architected around AI and workflow engines.

How the agent works

Invoice Processing

The AI Agent handles classic invoice processing, the kind typically handled by Accounts Payable team. Its a lightweight build: not as advanced as some OCR or invoice agents others have built in n8n, but fast, functional, and enough to prove the point.

Here's how it works: 

Upload&Analyse
1 Upload and analyse step of the prepayment AI agent. The workflow extracts invoice data via OCR, uses OpenAI to interpret that data and map to invoice fields, and retrieves matching contact details from Xero.
Match and Process
2 Match and process step of the workflow. The AI agent checks if the invoice contact exists in Xero, creates the contact if needed, and posts the invoice to Xero automatically.
Example invoice to upload
Here is an example of an invoice uploaded to the workflow. 
xero invoice capture-1
This is a screenshot from Xero showing the invoice processed in the system after the workflow has run.

 

Prepayment Automation

The first AI Agent works on a daily basis to handle invoices each time they are received by vendors. The prepayment AI Agent handles the core month-end logic, taking invoices coded to prepayments and turning them into a complete amortisation schedule and journal entry.

Here’s how it works:

Get Prepayment Invoices
1 The first step pulls any invoices recorded to prepayments general ledger account from Xero and saves the results to a working sheet for further processing.
Analyse Invoices
2 The next step uses OpenAI to extract key details like prepayment start and end dates, and to suggest the appropriate expense account for release. It then updates the invoice sheet in Google Sheets and calculates values such as the number of days and daily rate.
Prepayment workpaper

3 This step calculates how each invoice’s prepayment should be spread across the service period, producing a structured prepayment allocation schedule.

Prepayment workpaper google sheet
Here is an example of the prepayment workpaper produced by the previous steps. This is somewhat typical of what accounts today prepare in excel with the first columns identifying key invoice details and then the later columns showing how the invoice amount is apportioned month to month.
Prepayment Journal
4 The workflow identifies the correct month-end, prepares journal entries via Apps Script, and stores them in memory for downstream approval and posting.
prepayment journal google sheet
Here is an example of the journal output produced by the previous steps. It's consistent with how many accountants would prepare it, and is simply picking up the relevant details from the prepayment schedule shown earlier and adding other relevant journal fields such as date and description.
Approval and Process In Xero
5 The final steps obtains the human signoff via an email. On receipt of approval the journal is automatically posted to Xero.  
Xero journal
Here is a screenshot from Xero showing the month-end prepayment journal posted in the system.  

What this proves

There you have it, a fully autonomous end-to-end prepayment AI agent. This wasn’t just invoice data extraction but evidence of a full month-end logic, handled by an AI agent. It can do the work that used to take an accountant hours in just mere moments.

Prepayments are just the beginning, this approach can be extended to most month-end tasks performed by an accountant in excel today. Think:

  • Accruals
  • Lease journals
  • Revenue recognition
  • Depreciation
  • Foreign Currency Revaluations
  • Provisions
  • Payroll accruals

In fact, any recurring process that relies on a spreadsheet, from tax calculations to reconciliations, could be reimagined as an AI Agent driven workflow.

These are all processes that in lots of businesses live outside the ERP, but could now be automated end-to-end with the right combination of tools. 

Why this matters for finance teams

AI agents aren’t just a future concept, they’re already capable of running structured, repeatable finance workflows. But adopting them isn’t just about what’s technically possible,  it’s about what fits your team, your systems, and your stage of growth. 

What You Stand to Gain:

⏱ Time saved on repetitive, manual tasks

🧠 Talent redeployed to higher-value work

📉 Faster, more consistent month-end closes

What You Need to Consider:

🧰 Team ownership – automation only delivers long-term value if your team can maintain it. One-off builds by consultants often fall over without internal capability to maintain and improve it.

🧱 ERP maturity – larger ERPs already cover many workflows such as prepayments smaller companies manage in spreadsheets. It’s probably only a matter of time before they embed AI to fully automate those processes.

🛠 Build vs buy – automation is now far easier to build internally. That could tip the scales toward in-house solutions, or give you more leverage when negotiating pricing with vendors.

 

🧭 The direction is clear: agentic AI is coming. Now’s the time to get your data, systems, and teams ready.

But if you’re ready to dive in today — with a finance-specific AI Agent that improves financial reporting accuracy and requires no setup — Discover:

 

📊 It helps finance teams review reports faster and catch issues before they reach investors, the boardroom, or your boss.


Interested in learning more about AI and Finance. Here is some further reading:

Finance and Agentic AI

Agents, Not Assistants


 

Share this post