What this workflow does
This n8n workflow saves time by automatically reading invoice line items from files added to Google Drive.
It stops the need to type data by hand and reduces errors.
Invoices dropped in a specific Drive folder are sent to an AI parser that extracts details like product names, quantities, and prices.
The data is then saved into a database or Airtable for easy tracking.
You get faster and more accurate invoice processing without manual work.
Who should use this workflow
This is for people who handle many invoices in PDF form.
If invoice info is copied by hand from PDF files in Google Drive, this helps cut that manual task.
It suits accountants, bookkeepers, or firms that want quicker invoice data processing.
Users must have basic n8n setup and API keys ready.
Tools and services used
- Google Drive Trigger: Detects new invoice files in a chosen folder.
- HTTP Request node: Sends invoice PDF to AI (LlamaParse/OpenAI) for parsing.
- Webhook node: Receives structured invoice data back from the parser.
- Code node: Extracts individual line items from the AI response.
- Airtable or Database nodes: Save invoice and item details as records.
Inputs, processing steps, and outputs
Inputs
- New invoice PDF uploaded to a set Google Drive folder.
- OpenAI API key with permission to parse files.
- Webhook URL for receiving parse results.
Processing Steps
- Google Drive Trigger fires when invoice arrives.
- HTTP Request node posts file to OpenAI chat completions API in multipart form data.
- Webhook node gets JSON response containing parsed invoice line items.
- Code node runs JavaScript to extract and format individual items from AI response.
- Database or Airtable nodes then create invoice and line item records linked together.
Outputs
- Fully parsed invoice stored in your chosen database.
- Separate database records for each invoice line item (description, quantity, unit price, amount).
- Reduction in manual effort and human error.
Beginner step-by-step: How to run this workflow in n8n
Import the workflow
Download the workflow file from this page.
Inside n8n editor, choose Import from File and select the downloaded workflow.
Configure credentials and variables
Add Google Drive credentials with access to your invoice folder.
Add OpenAI API Key in the HTTP Request node credentials.
Set correct Drive folder ID if needed.
Update the webhook URL in LlamaParse service to match the Webhook node URL.
Change Airtable or database table identifiers to your setup.
Test and activate
Run the workflow manually or upload a test file to your Google Drive invoice folder.
Look out for any errors in logs.
Once testing works, turn on workflow activation.
This makes workflow run automatically for every new invoice.
Consider self-host n8n if using own server.
Code snippet for parsing AI response
This JavaScript in the Code node reads the invoice items from the webhook JSON.
// Get the input from the Webhook node
const input = $("Webhook").first().json;
// Prepare an array for items
const outputItems = [];
// Find the content string in AI response
const content = input.choices[0]?.message?.content;
if (content) {
try {
// Parse the JSON inside the content field
const parsedContent = JSON.parse(content);
// If items array exists, add each item as an output object
if (Array.isArray(parsedContent.items)) {
outputItems.push(...parsedContent.items.map(i => ({ json: i })));
}
} catch (error) {
// If parsing error occurs, log it
console.error('Error parsing content:', error);
}
}
// Return list of line items
return outputItems;
Customization options
- Change AI model in the HTTP Request node by editing the “model” field to try different OpenAI models for parsing.
- Adjust Google Drive Trigger node to watch different or multiple invoice folders.
- Edit JavaScript in the Code node to format amounts as numbers instead of strings for calculations.
Common troubleshooting tips
Webhook not receiving data: Check if the webhook URL is correctly set in the parsing service settings.
Test webhook with tools like Postman or curl to confirm it is reachable.
Failed HTTP request to OpenAI API: Ensure API key is correct and present in the HTTP Request node headers.
Verify content type is set to “multipart-form-data” for file uploading.
Summary of results
✓ Automatically reads invoices from Google Drive folder.
✓ Extracts detailed line items using AI parsing.
✓ Saves structured data in database or Airtable.
✓ Cuts down manual entry errors and time.
✓ Runs every time a new invoice is uploaded.
