Generate Google Drive invoice PDFs from plain text with OpenAI and PDFCrowd
Quick overview This sub-workflow accepts plain-text invoice details, uses OpenAI to extract and normalize invoice fields, renders a styled HTML invoice to PDF via PDFCrowd, uploads the PDF to Google Drive, and returns a shareable Drive link while clearing working tabs in Google Sheets.
How it works Receives invoice details as input from a parent workflow. Uses OpenAI to parse the free text into a fixed set of invoice fields and calculations, with a structured output parser that retries and auto-fixes malformed JSON. Adds company metadata and today’s invoice date, and maps the extracted values into the fields used for the invoice. Builds a styled HTML invoice document from the structured fields. Sends the HTML to the PDFCrowd API to generate an A4 PDF. Uploads the generated PDF to a specified Google Drive folder and returns a view URL. Clears rows in the “Invoice Input” and “Invoice Output” tabs in Google Sheets to prepare for the next run.
Setup Add an OpenAI API credential for the chat model used to extract and structure invoice data. Add Google Drive and Google Sheets credentials, then set YOUR_DRIVE_FOLDER_ID and YOUR_GOOGLE_SHEET_ID to your target folder and spreadsheet. Create a PDFCrowd account and replace the Authorization header with your base64-encoded username:apiKey value. Update the invoice template placeholders in the HTML (company name, address, email, TRN, and payment details) and set YOUR_COMPANY_TAX_NUMBER in the invoice fields mapping.
Related Templates
Track Demo Bookings with Google Calendar to Meta Conversions API Integration
Who is this workflow for? If you're using Meta Ads to generate new leads to your sales pipeline, this workflow is for yo...
Build an MCP Server which answers questions with Retrieval Augmented Generation
Build an MCP Server which has access to a semantic database to perform Retrieval Augmented Generation (RAG) Tutorial C...
Transcribe & Summarize Audio with Whisper and GPT, from Google Drive to Notion
This workflow contains community nodes that are only compatible with the self-hosted version of n8n. Overview This work...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments