# Convert legal timesheets to LEDES and PDF invoices with OpenAI: n8n workflow

> Started by an arriving email, and works across Email, Excel and Outlook. It hands the judgement calls to OpenAI.

Source: https://millionrounds.com/workflow/convert-legal-timesheets-to-ledes-and-pdf-invoices-with-open (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

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

Large Calls a model: OpenAI

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fconvert-legal-timesheets-to-ledes-and-pdf-invoices-with-open)

**27 steps** Large: read it before trusting it with anything live

**2** Branches: places the flow splits

**0** Loops or waits

**3** Services it connects to

## The flow

Model 4 Logic 15 Service 8

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

- 1 **IMAP, Watch Inbox** Email Read Imap *Service*
- 2 **LLM, GPT-4o (Time Entries)** Lm Chat Open Ai *Model*
- 3 **LLM, GPT-4o-mini (Sender Info)** Lm Chat Open Ai *Model*
- 4 **Classify Attachment** Code *Logic*
- 5 **AI Agent, Extract Time Entries** Agent *Model*
- 6 **AI Agent, Extract Sender Info** Agent *Model*
- 7 **If PDF** If *Logic*
- 8 **If Word** If *Logic*
- 9 **Excel, Read Invoice Numbers** Microsoft Excel *Service*
- 10 **Parse Time Entry Output** Code *Logic*
- 11 **Merge Sender Info** Code *Logic*
- 12 **Extract, PDF Text** Extract From File *Service*
- 13 **Extract, Word Text** Word2text *Service*
- 14 **Get Next Invoice Number** Code *Logic*
- 15 **Merge, Time Entries + Invoice Number** Merge *Logic*
- 16 **Generate, LEDES 1998B** Code *Logic*
- 17 **Generate, LEDES XML 2.0** Code *Logic*
- 18 **Generate, Invoice HTML** Code *Logic*
- 19 **Prep Excel Rows** Code *Logic*
- 20 **Create, LEDES 1998B File** Code *Logic*
- 21 **Create, LEDES XML File** Code *Logic*
- 22 **Convert HTML to PDF** Http Request *Service*
- 23 **Excel, Append Time Entries** Microsoft Excel *Service*
- 24 **Merge, LEDES 1998B + XML** Merge *Logic*
- 25 **Merge, All Files** Merge *Logic*
- 26 **Excel, Append Invoice Number** Microsoft Excel *Service*
- 27 **Send a message** Microsoft Outlook *Service*

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

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Fconvert-legal-timesheets-to-ledes-and-pdf-invoices-with-open)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Email](https://millionrounds.com/workflows?service=Email#library)[Excel](https://millionrounds.com/workflows?service=Excel#library)[Outlook](https://millionrounds.com/workflows?service=Outlook#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Automate invoice creation & smart reminders with Jotform** 27 steps · calls a model · Outlook, n8n data table](https://millionrounds.com/workflow/automate-invoice-creation-and-smart-reminders-with-jotform)
- [**Generate invoices and send AI-summarized reminders** 27 steps · calls a model · Email, n8n data table](https://millionrounds.com/workflow/generate-invoices-and-send-ai-summarized-reminders)
- [**Create work4all incoming invoices** 26 steps · Outlook](https://millionrounds.com/workflow/create-work4all-incoming-invoices)
- [**Run bounded dunning for Lago payment failures** 25 steps · Email, n8n data table](https://millionrounds.com/workflow/run-bounded-dunning-for-lago-payment-failures)
- [**Extract and log Outlook invoices to OneDrive Excel with OpenAI** 24 steps · calls a model · Excel, Outlook](https://millionrounds.com/workflow/extract-and-log-outlook-invoices-to-onedrive-excel-with-open)
- [**Create Zoho Books invoices from email attachments** 23 steps · calls a model · Email](https://millionrounds.com/workflow/create-zoho-books-invoices-from-email-attachments)
