Automation library · Money admin

Convert legal timesheets to LEDES and PDF invoices with OpenAI

Started by an arriving email, and works across Email, Excel and Outlook. It hands the judgement calls to OpenAI. 27 steps, 2 branches: large, and worth reading before you trust it with anything live.

LargeCalls a model: OpenAI

27 stepsLarge: read it before trusting it with anything live
2Branches: places the flow splits
0Loops or waits
3Services it connects to

The flow

Model 4Logic 15Service 8

The steps in the order they run, from what starts it.

  1. 1IMAP, Watch InboxEmail Read ImapService
  2. 2LLM, GPT-4o (Time Entries)Lm Chat Open AiModel
  3. 3LLM, GPT-4o-mini (Sender Info)Lm Chat Open AiModel
  4. 4Classify AttachmentCodeLogic
  5. 5AI Agent, Extract Time EntriesAgentModel
  6. 6AI Agent, Extract Sender InfoAgentModel
  7. 7If PDFIfLogic
  8. 8If WordIfLogic
  9. 9Excel, Read Invoice NumbersMicrosoft ExcelService
  10. 10Parse Time Entry OutputCodeLogic
  11. 11Merge Sender InfoCodeLogic
  12. 12Extract, PDF TextExtract From FileService
  13. 13Extract, Word TextWord2textService
  14. 14Get Next Invoice NumberCodeLogic
  15. 15Merge, Time Entries + Invoice NumberMergeLogic
  16. 16Generate, LEDES 1998BCodeLogic
  17. 17Generate, LEDES XML 2.0CodeLogic
  18. 18Generate, Invoice HTMLCodeLogic
  19. 19Prep Excel RowsCodeLogic
  20. 20Create, LEDES 1998B FileCodeLogic
  21. 21Create, LEDES XML FileCodeLogic
  22. 22Convert HTML to PDFHttp RequestService
  23. 23Excel, Append Time EntriesMicrosoft ExcelService
  24. 24Merge, LEDES 1998B + XMLMergeLogic
  25. 25Merge, All FilesMergeLogic
  26. 26Excel, Append Invoice NumberMicrosoft ExcelService
  27. 27Send a messageMicrosoft OutlookService

How it's built

Starts on
An arriving email
Steps
27, with 2 branches
Size
Large: read it before trusting it with anything live
Connects to
Email, Excel, Outlook
Model
OpenAI

Questions

What does it need to run?

An n8n account, plus your own Email, Excel and Outlook accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an arriving email.

Does it use AI?

Yes. It calls OpenAI. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 27 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

Before you run it

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 27 steps before you point it at anything that matters.