Extract,Save Invoice Data from Google Drive and send to Sheets using AI
This workflow automates the extraction of structured invoice data from PDF files placed in a Google Drive folder and saves the results into a Google Sheet. It uses Dumpling AI's document extraction API to parse key fields like order number, line items, totals, and addresses. This is ideal for accounting teams, procurement departments, or anyone handling a high volume of supplier invoices.
Node Breakdown
- Google Drive Trigger – Watch Folder for New Files (Google Drive Trigger) — OAuth2. Polls a specified Google Drive folder every minute and triggers the workflow when a new file is created.
- Download Invoice File (Google Drive) — OAuth2. Downloads the newly created file from Drive using its file ID (
$json.id). - Convert invoice File to Base64 (Extract From File) — No auth. Converts the downloaded file binary to a base64 string for API submission.
- Send file to Dumpling AI for Data Extraction (HTTP Request) — Header Auth. Sends a POST request to
https://app.dumplingai.com/api/v1/extract-documentwith a JSON body containing the base64 file and a prompt instructing the AI to extract order number, document date, PO number, shipping/sold-to details, line items, and total amounts. The API key is passed via an HTTP header credential. - Parse Dumpling AI JSON Response (Code) — No auth. Executes JavaScript to parse the
resultsfield from the API response (a JSON string) into a structured object. - Split line Items from Invoice (Split Out) — No auth. Splits the
itemsarray into separate items so each line item becomes a row in the spreadsheet. - Save Data to Google Sheet (Google Sheets) — OAuth2. Appends a row to the target sheet with all extracted fields mapped to columns (Order number, Document Date, PO number, Sold to/Ship to names and addresses, Model, Description, Quantity, Unit Price, Total Price).
Setup Instructions
- Google Services: You need a Google account with access to Google Drive and Google Sheets. Create a Google Drive folder for incoming invoices and a Google Sheet (with headers matching the column names above). In n8n, use OAuth2 credentials for both the Google Drive and Google Sheets nodes.
- Dumpling AI: Sign up for a Dumpling AI account and obtain an API key. In n8n, create an HTTP Header Auth credential with the key name (e.g.,
Authorization) and value (e.g.,Bearer your-api-key). - Workflow Configuration: Update the folder ID in the Google Drive Trigger node, the document ID and sheet name in the Google Sheets node, and ensure the Dumpling AI endpoint and prompt are correct. The prompt can be customized to extract different fields.
Use Cases and Variations
- Accounts Payable Automation: Automatically capture invoice details and post them to accounting software like QuickBooks, Xero, or ERP systems.
- Multi-format Support: Dumpling AI can handle PDFs, images, and other document types. Modify the prompt to extract data from purchase orders, receipts, or contracts.
- Error Handling: Add an error workflow or a Slack notification if extraction fails, or route failed invoices to a separate review sheet.
- Batch Processing: Replace the trigger with a scheduled poll or manual upload event to process existing invoices retroactively.
8 nodesmanual triggerFinance
Google DriveExtract From FileHTTP RequestCodeSplit OutGoogle SheetsSticky Note
Workflow JSON
{
"id": "Q9K6tDu4TJpqtRQ1",
"meta": {
"instanceId": "a1ae5c8dc6c65e674f9c3947d083abcc749ef2546dff9f4ff01de4d6a36ebfe6",
"templateCredsSetupCompleted": true
},
"name": "Extract and Save Invoice Data from Google Drive to Sheets with Dumpling AI",
"tags": [],
"nodes": [
{
"id": "4cdec8f8-9e08-433f-832d-18a9af3f4531",
"name": "Google Drive Trigger – Watch Folder for New Files",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-160,
-180
],
"parameters": {
"event": "fileCreated",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultUrl": "https://drive.google.com/drive/folders/1Dquh3PguyBImKvHlbkp55NBvYoB8IKr5",
"cachedResultName": "invoice-n8n"
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "credential-id",
"name": "googleDriveOAuth2Api Credential"
}
},
"typeVersion": 1
},
{
"id": "b67aea52-5f39-4fce-b476-d3b991b30519",
"name": "Download Invoice File",
"type": "n8n-nodes-base.googleDrive",
"position": [
60,
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud