{"product_id":"n8n-workflow-extract-legal-time-from-email-pdfs-to-ledes","title":"n8n Workflow: Extract Legal Time from Email PDFs to LEDES","description":"\u003ch3\u003eExtract legal time from email PDF\/Word bills and auto-generate LEDES deliverables\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow automatically monitors an IMAP inbox for new emails with PDF\/Word attachments, extracts legal time entries using OpenAI, and generates \u003cstrong\u003eLEDES 1998B\u003c\/strong\u003e, \u003cstrong\u003eLEDES XML 2.0\u003c\/strong\u003e, and a PDF invoice—then logs everything in \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e and emails the finished files back via \u003cstrong\u003eGmail\u003c\/strong\u003e.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIMAP trigger:\u003c\/strong\u003e Watches for new \u003cem\u003eunread\u003c\/em\u003e emails, downloads the first attachment, and proceeds only when an attachment is detected.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAttachment text extraction:\u003c\/strong\u003e Detects whether the attachment is a \u003cstrong\u003ePDF\u003c\/strong\u003e or \u003cstrong\u003eWord\u003c\/strong\u003e document and extracts its text accordingly.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI-powered extraction:\u003c\/strong\u003e Uses OpenAI to extract structured time entries plus summary metadata from the document text.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEmail remittance capture:\u003c\/strong\u003e Uses OpenAI to extract the sender’s remittance details from the email content, then merges those details with the extracted time-entry data.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eInvoice numbering:\u003c\/strong\u003e Reads existing invoice numbers from \u003cstrong\u003eGoogle Sheets\u003c\/strong\u003e, calculates the next invoice number, and attaches it to the invoice output.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLEDES generation + PDF creation:\u003c\/strong\u003e Builds \u003cstrong\u003eLEDES 1998B\u003c\/strong\u003e text, \u003cstrong\u003eLEDES XML 2.0\u003c\/strong\u003e, and an invoice HTML. Converts the HTML to a PDF using a \u003cstrong\u003eGotenberg-compatible HTTP endpoint\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLogging + delivery:\u003c\/strong\u003e Appends LEDES-style line items and the new invoice number to Google Sheets, then sends an HTML email with the \u003cstrong\u003ePDF\u003c\/strong\u003e, \u003cstrong\u003eLEDES TXT\u003c\/strong\u003e, and \u003cstrong\u003eLEDES XML\u003c\/strong\u003e files attached via Gmail.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eAutomation engineers streamlining legal billing intake from vendor emails.\u003c\/li\u003e\n  \u003cli\u003eSaaS operators standardizing LEDES output for timekeepers’ PDF\/Word submissions.\u003c\/li\u003e\n  \u003cli\u003eTeams reducing manual rekeying of legal time entries into LEDES 1998B \/ XML 2.0.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes \/ tools:\u003c\/strong\u003e \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003egmail\u003c\/code\u003e, \u003ccode\u003emerge\u003c\/code\u003e, \u003ccode\u003esticky note\u003c\/code\u003e, \u003ccode\u003ehttp request\u003c\/code\u003e\n\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations:\u003c\/strong\u003e IMAP email trigger, OpenAI (for time + remittance extraction), Google Sheets (invoice numbers + logging), Gotenberg-compatible HTML-to-PDF endpoint, Gmail (returning generated files).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45865757114547,"sku":"N8N-18387","price":25.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/lpFjHeG54Fp9d3QHS769r_jix4XPWH.png?v=1787043894","url":"https:\/\/buyflowscripts.com\/products\/n8n-workflow-extract-legal-time-from-email-pdfs-to-ledes","provider":"N8N Commerce","version":"1.0","type":"link"}