Back to Templates

Convert legal timesheets to LEDES and PDF invoices with GPT-4o, Excel and Outlook

Created by

Created by: AI Solutions || legalgpts
AI Solutions

Last update

Last update 15 hours ago

Share


⚖️ LEDES Invoice Converter

AI-Powered Legal Billing Automation

This workflow monitors an email inbox for timesheet attachments (PDF or Word), extracts time entries using AI, and automatically generates three billing formats plus a branded PDF invoice — all returned to the sender by email.

How it works

  1. Email trigger watches for new unread emails with attachments
  2. Classify Attachment detects PDF vs. Word (.docx/.doc)
  3. AI Agent (GPT-4o) extracts all time entries and assigns UTBMS task codes
  4. Second AI Agent extracts remit-to billing information from the email body/signature
  5. Invoice Number lookup queries your Excel tracker and increments automatically
  6. Four outputs generated in parallel: LEDES 1998B (.txt), LEDES XML 2.0 (.xml), branded PDF invoice, and Excel time record rows
  7. Confirmation email sent back to the original sender with all three billing files attached
  8. Excel records updated with time entries and new invoice number

Setup

  • Configure your IMAP credential on the Email Trigger node
  • Configure your OpenAI credential on both Chat Model nodes
  • Configure your Gmail OAuth2 credential on the Send Invoice Email node
  • Configure your Microsoft Excel OAuth2 credential on the three Excel nodes
  • Point the Excel nodes at your own timesheets.xlsx workbook, worksheet, and table names
  • Configure Gotenberg HTTP Basic Auth credential on the Convert HTML to PDF node
  • Update the logo URL in Generate Invoice HTML if using your own branding

Customization

  • Adjust the LGT- invoice number prefix in Get Next Invoice Number
  • Modify UTBMS task code defaults in the AI Agent system prompt
  • Update branding colors and logo in Generate Invoice HTML

⚠️ Community Node Required

n8n-nodes-word2text must be installed on a self-hosted n8n instance.
This workflow will not run on n8n Cloud unless you replace the Word2Text node with an alternative.