Google Drive to Google Sheets, clean invoice line items
Invoice PDFs are the worst kind of “simple.” The info is right there, but getting it into a spreadsheet still means squinting, copying, pasting, and fixing weird formatting.
This invoice line automation hits ops teams first, but accountants and small business owners feel it too. When every invoice has 10 or 30 line items, manual entry quietly steals hours each week.
This workflow watches a Google Drive folder, extracts every invoice line item with Dumpling AI, and appends clean rows into Google Sheets. You’ll see how it works, what you need, and what to tweak so it matches your invoice format.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Google Drive to Google Sheets, clean invoice line items
flowchart LR
subgraph sg0["Google Drive Trigger – Watch Folder for New Files Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "Google Drive Trigger – Watch..", pos: "b", h: 48 }
n1@{ icon: "mdi:cog", form: "rounded", label: "Download Invoice File", pos: "b", h: 48 }
n2@{ icon: "mdi:cog", form: "rounded", label: "Convert invoice File to Base64", pos: "b", h: 48 }
n3["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Send file to Dumpling AI for.."]
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/code.svg' width='40' height='40' /></div><br/>Parse Dumpling AI JSON Respo.."]
n5@{ icon: "mdi:swap-vertical", form: "rounded", label: "Split line Items from Invoice", pos: "b", h: 48 }
n6@{ icon: "mdi:database", form: "rounded", label: "Save Data to Google Sheet", pos: "b", h: 48 }
n1 --> n2
n5 --> n6
n2 --> n3
n4 --> n5
n3 --> n4
n0 --> n1
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n0 trigger
class n6 database
class n3 api
class n4 code
classDef customIcon fill:none,stroke:none
class n3,n4 customIcon
The Problem: Invoice PDFs Don’t Turn Into Usable Data
PDF invoices were designed to be read, not processed. So when you need each line item in a spreadsheet (model, description, quantity, unit price, total price), you end up doing clerical work that feels invisible but never ends. One invoice turns into a dozen copy/paste actions. Then you’re cleaning commas, fixing broken columns, and realizing the “Unity price” column is full of text because one row had a currency symbol. Multiply that by a busy week, and it’s not just time. It’s attention, accuracy, and momentum.
It adds up fast. Here’s where it breaks down in real teams.
- Someone mistypes a unit price or quantity, and you only catch it when totals don’t match later.
- Line items end up inconsistent, which means filtering and sorting becomes unreliable.
- Invoices pile up because “I’ll do them later” turns into an hour-long task.
- Even if you delegate the work, you still spend time checking it.
The Solution: Auto-Extract Invoice Line Items Into Google Sheets
This workflow removes the manual step entirely. When a new invoice PDF lands in a specific Google Drive folder, n8n picks it up automatically and downloads the file. It then converts the file into a Base64 payload (basically a format that can be sent cleanly to an API) and submits it to Dumpling AI’s extract-document endpoint with a detailed prompt that tells the AI exactly what fields to pull. Dumpling AI responds with structured JSON data, which n8n parses and splits into individual line items. Finally, it appends one clean row per line item into your Google Sheet, along with the invoice header details like order number, PO number, and ship-to / sold-to info.
The workflow starts in Google Drive, then runs the invoice through Dumpling AI for extraction. After that, Google Sheets becomes your “system of record,” with every line item ready to filter, pivot, and audit without retyping anything.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you process 25 invoices a week, and each one has about 15 line items. Manually, you might spend around 2 minutes per line item once you include copying, fixing columns, and sanity-checking totals, which comes out to roughly 12 hours a week. With this workflow, you drop invoices into one Google Drive folder and wait for the sheet to populate, usually in a minute or two per invoice. You still review the sheet, but you’re reviewing, not typing.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Google Drive to store and detect new invoice PDFs.
- Google Sheets to store clean invoice line item rows.
- Dumpling AI API key (get it from your Dumpling AI account settings).
Skill level: Beginner. You’ll connect accounts, paste IDs (folder, sheet), and adjust a prompt if your invoices are unusual.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A Google Drive folder triggers the run. When a new invoice file appears in the chosen folder, n8n grabs the file immediately so you don’t have to forward emails or click buttons.
The invoice is prepared for extraction. The workflow downloads the PDF and encodes it into Base64 so it can be sent reliably in an API request.
Dumpling AI turns the PDF into structured data. n8n sends the file to the extract-document endpoint with a prompt that asks for headers (order number, PO number, addresses) and the full items table (model, description, quantity, unit price, total price).
Google Sheets gets one row per line item. The response is parsed, the items array is expanded, and each item is appended to your sheet alongside the header fields so every row stays tied to its invoice.
You can easily modify the columns captured in the prompt to match your sheet layout based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Drive Folder Watch Trigger
This workflow starts when a new file is created in a specific Google Drive folder.
- Add and open Drive Folder Watch Trigger.
- Set Event to
fileCreatedand Trigger On tospecificFolder. - In Folder to Watch, select the folder named
Invoice Folder. - Credential Required: Connect your
googleDriveOAuth2Apicredentials.
Step 2: Connect Google Drive and Download the Invoice
The workflow downloads the newly created invoice file and prepares it for AI extraction.
- Open Fetch Invoice File and set Operation to
download. - Set File ID to
{{ $json.id }}. - Credential Required: Connect your
googleDriveOAuth2Apicredentials. - Open Encode File to Base64 and set Operation to
binaryToPropery.
{{ $json.id }}, the download will fail and the workflow won’t progress.Step 3: Set Up the AI Extraction and Parsing
This stage sends the file to Dumpling AI, parses the JSON response, and splits line items.
- Open AI Extraction Request and set Method to
POST. - Set URL to
https://app.dumplingai.com/api/v1/extract-document. - Set JSON Body to
{.
"inputMethod": "base64",
"files": ["{{ $json.data }}"],
"prompt": "Extract the order number, document date, PO number, sold to name and address, ship to name and address, list of items with model, quantity, unit price, and total price, and the final total amount including tax.",
"jsonMode": "true"
} - Credential Required: Connect your
httpHeaderAuthcredentials. - Open Parse AI JSON Output and keep the code as-is:
const raw = $input.first().json.results; const parsed = JSON.parse(raw); return [{ json: parsed }];. - Open Expand Invoice Line Items and set Field to Split Out to
items.
results.Step 4: Configure the Google Sheets Output
Each line item is appended as a new row in your Google Sheet along with header fields.
- Open Append Rows to Sheet and set Operation to
append. - Select Document as
Invoice Sheetand Sheet asSheet1. - Map columns using these expressions: Model →
{{ $json.model }}, Quantity →{{ $json.quantity }}, Po_number →{{ $('Parse AI JSON Output').item.json.PO_number }}, Description →{{ $json.description }}, Total price →{{ $json.total_price }}, Unity price →{{ $json.unit_price }}, Order number →{{ $('Parse AI JSON Output').item.json.order_number }}, Ship to name →{{ $('Parse AI JSON Output').item.json.ship_to_name }}, Sold to name →{{ $('Parse AI JSON Output').item.json.sold_to_name }}, Document Date →{{ $('Parse AI JSON Output').item.json.document_date }}, Ship to address →{{ $('Parse AI JSON Output').item.json.ship_to_address }}, Sold to address →{{ $('Parse AI JSON Output').item.json.sold_to_address }}. - Credential Required: Connect your
googleSheetsOAuth2Apicredentials.
Step 5: Test and Activate Your Workflow
Validate the end-to-end run and enable the trigger for production use.
- Click Execute Workflow and upload a test invoice to the watched folder.
- Confirm AI Extraction Request returns a JSON payload and Parse AI JSON Output emits structured fields.
- Verify new rows appear in
Invoice Sheet→Sheet1with line item data. - Toggle the workflow to Active to start monitoring the folder continuously.
Common Gotchas
- Google Drive credentials can expire or need specific permissions. If things break, check the n8n credential connection status and the folder sharing/access first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Dumpling AI API keys can get rotated, and a missing or wrong key will look like a “random” HTTP error. Check the HTTP Request node headers and Dumpling AI account settings before changing anything else.
Frequently Asked Questions
About 30 minutes if your Google accounts are already connected.
No. You’ll mainly paste IDs and connect accounts in n8n. The workflow already includes the parsing logic, so you’re configuring, not programming.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Dumpling AI API usage costs, which depend on how many invoices you process.
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you’ll want to. You can modify the prompt inside the Dumpling AI HTTP Request node to capture extra fields like tax, shipping, discounts, or invoice number naming differences. Common customizations include renaming sheet columns, adding a “Vendor” column, and filtering by file name or subfolder when you have multiple invoice templates.
Usually it’s expired or unauthorized Google credentials in n8n. Reconnect Google Drive in your n8n credentials, then confirm the watched folder ID is correct and that the account has access to that folder. If the trigger fires but the download fails, the file may not be a supported type or it was moved right after upload. Less common, but real: Google API rate limits when you dump a big backlog into the folder at once.
Practically, hundreds a day for most small teams. On n8n Cloud, the limit depends on your monthly execution allowance, while self-hosting has no fixed execution cap (it’s mainly your server size). The workflow processes one invoice at a time and then one row per line item, so a “huge” invoice with 200 lines will create a lot more spreadsheet writes than a small one.
Often, yes, if you care about reliable parsing and line-item expansion. n8n makes it easier to handle arrays (line items), add conditional logic, and self-host for high volume without getting punished per step. Zapier and Make can work, but multi-row invoice writes get messy quickly, and the cost can climb once you’re doing AI extraction plus row-by-row inserts. If you just need a basic “log the invoice” flow, those tools might be fine. Talk to an automation expert if you want help choosing.
Once this is running, invoices stop being a weekly data-entry chore. The sheet stays clean, your line items stay usable, and you get your time back for work that actually moves the business.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.