Skip to main content

Convert legal timesheets to LEDES and PDF invoices

Workflow preview

Workflow preview
100%
Convert legal timesheets to LEDES and PDF invoices preview
Open on n8n.io

1. Workflow Overview

Who is this for This template is built for solo attorneys, small law firms, and legal billing coordinators who receive timesheet documents by email and need to produce LEDES compliant e billing fil...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.emailreadimap, n8n-nodes-base.code, n8n-nodes-base.if, n8n-nodes-base.microsoftexcel, n8n-nodes-base.extractfromfile, n8n-nodes-word2text.word2text, @n8n/n8n-nodes-langchain.lmchatopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by AI Solutions.

Original n8n.io source

1.1 Workflow description

Title
Convert legal timesheets to LEDES and PDF invoices
Workflow name
Convert legal timesheets to LEDES and PDF invoices

Who is this for

This template is built for solo attorneys, small law firms, and legal billing coordinators who receive timesheet documents by email and need to produce LEDES-compliant e-billing files for client billing management systems. If you have an IMAP inbox, an OpenAI API key, a self-hosted Gotenberg instance, and a Microsoft 365 account, you can have AI-processed LEDES invoices delivering automatically in under 30 minutes of setup.

What it does

The workflow monitors an inbox for emails with PDF or Word timesheet attachments, extracts all time entries using GPT-4o, assigns UTBMS task codes, auto-increments an invoice number, and returns a PDF invoice, LEDES 1998B file, and LEDES XML 2.0 file to the original sender — all without any manual data entry.

How it works

An IMAP — Watch Inbox trigger monitors for unread emails with attachments. Classify Attachment detects whether the file is a PDF or Word document and routes it to the correct extractor.

Extract — PDF Text or Extract — Word Text pulls the raw text content from the attachment and passes it to the AI pipeline.

AI Agent — Extract Time Entries uses GPT-4o to parse all time entries from the document, capture date, timekeeper, hours, rate, description, client, and matter fields, and assign the best-fit UTBMS ABA task code (A101–A111) for each line. If rate or timekeeper information is missing, configurable defaults are applied automatically.

AI Agent — Extract Sender Info runs a second GPT-4o-mini pass over the email body and signature to extract the sender's name, address, and contact details for the "Remit To" section of the invoice.

Excel — Read Invoice Numbers queries your timesheets.xlsx tracking workbook via Microsoft Graph API to find the last issued invoice number and increment it automatically.

Merge — Time Entries + Invoice Number combines the AI-extracted data with the new invoice number, then fans out to four parallel generation nodes.

Generate — LEDES 1998B, Generate — LEDES XML 2.0, Generate — Invoice HTML, and Prep Excel Rows run simultaneously to produce all outputs. All brand variables — logo URL, firm name, colors — are defined as named constants at the top of the Invoice HTML Code node for easy one-time customization.

Convert to PDF sends the finished HTML to your self-hosted Gotenberg instance, returning a print-ready US Letter PDF — no third-party PDF service required.

Send Invoice Email delivers all three billing files as attachments via Gmail OAuth2 back to the original sender. Excel — Append Time Entries and Excel — Append Invoice Number update your tracking workbook with the full LEDES row data and the new invoice record.

How to set up

  1. Install the n8n-nodes-word2text community node under Settings → Community Nodes and restart n8n.
  2. In IMAP — Watch Inbox, configure your IMAP credential for the inbox you want to monitor.
  3. On both LLM nodes, connect your OpenAI API credential.
  4. In Send Invoice Email, connect your Gmail OAuth2 credential.
  5. On all three Excel nodes, connect your Microsoft Excel OAuth2 credential and point each node at your timesheets.xlsx workbook, worksheet, and table.
  6. In Convert to PDF, update the Gotenberg base URL to your self-hosted instance and configure HTTP Basic Auth if required.
  7. In Get Next Invoice Number, update the 'INV-' prefix to match your firm's invoice numbering convention.
  8. In Generate — Invoice HTML, update logoUrl and the brand color constants to match your firm identity.

Requirements

  • Self-hosted n8n — required for the n8n-nodes-word2text community node
  • OpenAI API key (GPT-4o for time entry extraction; GPT-4o-mini for sender info)
  • IMAP-accessible inbox for monitoring incoming timesheets
  • Gmail account with OAuth2 configured in n8n
  • Microsoft 365 account with OneDrive or SharePoint access for Excel tracking
  • Self-hosted Gotenberg instance for HTML-to-PDF conversion

How to customize the workflow

  • Default billing rate — Change the fallback hourly rate in the AI Agent system prompt (currently $650/hr) to match your firm's standard rate.
  • UTBMS task codes — Add, remove, or redefine task code mappings in the AI Agent — Extract Time Entries system prompt to match your practice area or client requirements.
  • Invoice layout — All styling, fonts, colors, and section order are controlled inside Generate — Invoice HTML. The HTML uses @page CSS rules and table-based layout for reliable PDF rendering.
  • Email delivery — Swap the Gmail node for Outlook, SendGrid, or any SMTP-compatible service supported by n8n. The binary attachment references require no changes.
  • Approval gate — Insert a Wait node and an internal Slack or email notification between Convert to PDF and Send Invoice Email to require internal review before delivery.
  • Word-only or PDF-only — If you only process one file type, remove the unused branch and its corresponding If node to simplify the workflow.

Visit automatedintelligentsolutions.com for more information, support, and workflows.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Overview

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky — Trigger

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky — Classify

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky — AI Extraction

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Sticky — Generate

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 6 - Sticky — Deliver

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Sticky — Warning

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - IMAP — Watch Inbox

Type / Role
n8n-nodes-base.emailReadImap - emailReadImap
Config choices
Version 2

Block 9 - Classify Attachment

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 10 - If PDF

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 11 - If Word

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 12 - Excel — Read Invoice Numbers

Type / Role
n8n-nodes-base.microsoftExcel - microsoftExcel
Config choices
Version 2.2

Block 13 - Extract — PDF Text

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 14 - Extract — Word Text

Type / Role
n8n-nodes-word2text.word2text - word2text
Config choices
Version 1

Block 15 - Get Next Invoice Number

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 16 - LLM — GPT-4o (Time Entries)

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 17 - AI Agent — Extract Time Entries

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 18 - Parse Time Entry Output

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 19 - LLM — GPT-4o-mini (Sender Info)

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 20 - AI Agent — Extract Sender Info

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 2.2

Block 21 - Merge Sender Info

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Merge — Time Entries + Invoice Number

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 23 - Generate — LEDES 1998B

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 24 - Generate — LEDES XML 2.0

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Showing the first 24 of 34 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Convert legal timesheets to LEDES and PDF invoices
Complexity advanced
Nodes 34
Categories Invoice Processing, AI Summarization
Author AI Solutions
Published 17 Apr 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/15121/15121.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Convert legal timesheets to LEDES and PDF invoices do?

Who is this for This template is built for solo attorneys, small law firms, and legal billing coordinators who receive timesheet documents by email and need to produce LEDES compliant e billing fil...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.