8
n8n 中文网amn8n.com

Google Drive发票数据提取到Sheets

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 12 个节点。主要使用 Set, PDFco Api, GoogleDrive, GoogleSheets, ManualTrigger 等节点。 使用PDF.co AI解析器从Google Drive中提取发票数据到Sheets

前置要求
  • Google Drive API 凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "ad0113c344ee237399e44e9f11798b05baeb83a6196d514a9ae9d2ad71c3b5c9",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ab1b7d2d-7eac-45eb-9e0a-36f14c56df14",
      "name": "点击“执行工作流”时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -768,
        1856
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "869b9f99-2c91-48c8-bb9e-2f449fb8039a",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        1056
      ],
      "parameters": {
        "width": 400,
        "height": 1472,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6ec9845b-306b-456a-8831-0142e780db1a",
      "name": "便签55",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        1056
      ],
      "parameters": {
        "color": 7,
        "width": 1744,
        "height": 1472,
        "content": "# 📄 Google Drive → AI发票解析器 → Google Sheets(到期日志)"
      },
      "typeVersion": 1
    },
    {
      "id": "7750adf2-b5bd-4ed0-bf54-06b3b7878f5b",
      "name": "获取父文件夹ID",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -560,
        1952
      ],
      "parameters": {
        "filter": {},
        "options": {},
        "resource": "fileFolder",
        "queryString": "n8n Invoices"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "pl7bkYVKthXr65dR",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "5950e187-899f-4cd5-857b-ceb0bd5637f2",
      "name": "获取发票ID",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -336,
        1632
      ],
      "parameters": {
        "filter": {
          "folderId": {
            "__rl": true,
            "mode": "id",
            "value": "={{ $json.id }}"
          }
        },
        "options": {},
        "resource": "fileFolder",
        "queryString": "="
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "pl7bkYVKthXr65dR",
          "name": "Google Drive account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "1c9d75d1-84b0-4d78-99d6-c3bc8647405d",
      "name": "转换为URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -128,
        1824
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e7c4006d-b799-480d-a594-d7f72be006e4",
              "name": "link",
              "type": "string",
              "value": "=https://drive.google.com/file/d/{{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "44cc62d6-1764-4b6c-91c9-c0bd11e4bb37",
      "name": "AI发票解析器",
      "type": "n8n-nodes-pdfco.PDFco Api",
      "position": [
        96,
        2128
      ],
      "parameters": {
        "url": "={{ $json.link }}",
        "advancedOptions": {}
      },
      "credentials": {
        "pdfcoApi": {
          "id": "wGorcCULfsY1va25",
          "name": "PDF.co account"
        }
      },
      "executeOnce": false,
      "typeVersion": 1
    },
    {
      "id": "eeb6adb8-e18e-4589-802b-3545d4e1c845",
      "name": "设置字段",
      "type": "n8n-nodes-base.set",
      "position": [
        288,
        1632
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8544df44-2d59-475a-9080-75a2e59eb8df",
              "name": "Vendor",
              "type": "string",
              "value": "={{ $json.body.vendor.name }}"
            },
            {
              "id": "a3c4fab9-d62e-453b-be59-32d81d085c45",
              "name": "Invoice Date",
              "type": "string",
              "value": "={{ $json.body.invoice.invoiceDate }}"
            },
            {
              "id": "03dd461f-0fcc-466d-91c1-575f9f0157d1",
              "name": "Total",
              "type": "string",
              "value": "={{ $json.body.paymentDetails.total }}"
            },
            {
              "id": "d1ae2dc1-4e5a-40c1-9553-59b6394a3aca",
              "name": "Due Date",
              "type": "string",
              "value": "={{ $json.body.paymentDetails.dueDate }}"
            },
            {
              "id": "823e5828-ed31-4b03-995a-55cd53bd8e22",
              "name": "url",
              "type": "string",
              "value": "={{ $('Convert to URL').item.json.link }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a40f5ff5-c723-459b-8a4f-0e0affa19204",
      "name": "将数据存储到Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        576,
        2160
      ],
      "parameters": {
        "columns": {
          "value": {
            "Url": "={{ $json.url }}",
            "Total": "={{ $json.Total }}",
            "Vendor": "={{ $json.Vendor }}",
            "Due Date": "={{ $json['Due Date'] }}",
            "Invoice Date": "={{ $json['Invoice Date'] }}"
          },
          "schema": [
            {
              "id": "Vendor",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Vendor",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Due Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Due Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1002294955,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1a6QBIQkr7RsZtUZBi87NwhwgTbnr5hQl4J_ZOkr3F1U/edit#gid=1002294955",
          "cachedResultName": "Due"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1a6QBIQkr7RsZtUZBi87NwhwgTbnr5hQl4J_ZOkr3F1U",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1a6QBIQkr7RsZtUZBi87NwhwgTbnr5hQl4J_ZOkr3F1U/edit?usp=drivesdk",
          "cachedResultName": "Invoice Template"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "HlBW2puZbuCCq8jJ",
          "name": "Google Sheets account 3"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "26a8becd-467b-4fad-9700-296a137f17f0",
      "name": "便签61",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        1632
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 688,
        "content": "### 3) 连接Google Sheets (OAuth2)"
      },
      "typeVersion": 1
    },
    {
      "id": "e6420fe8-afa6-4861-aa2c-2c471de718e1",
      "name": "便签62",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        1552
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 544,
        "content": "### 1) 连接Google Drive (OAuth2)"
      },
      "typeVersion": 1
    },
    {
      "id": "3accccf6-0a7c-44e2-863b-e7a7a61a7115",
      "name": "便签64",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        1808
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 464,
        "content": "### 2) 连接PDF.co (AI发票解析器)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {
    "Convert to URL": [
      {
        "link": "https://drive.google.com/file/d/12zP_HE7V2AtxgjGQdQzpgs7YZeLyPkH6"
      },
      {
        "link": "https://drive.google.com/file/d/1WvQ1I7xX8uJ8jtHkvzyC4B9esgRDSL06"
      },
      {
        "link": "https://drive.google.com/file/d/1kpYIaDk7w1bCQSFP3Linl3MtTuq_rxky"
      }
    ],
    "Get Invoice ID's": [
      {
        "id": "12zP_HE7V2AtxgjGQdQzpgs7YZeLyPkH6",
        "name": "invoice_eu.pdf"
      },
      {
        "id": "1WvQ1I7xX8uJ8jtHkvzyC4B9esgRDSL06",
        "name": "invoice_uk.pdf"
      },
      {
        "id": "1kpYIaDk7w1bCQSFP3Linl3MtTuq_rxky",
        "name": "invoice_us.pdf"
      }
    ],
    "AI Invoice Parser": [
      {
        "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/V6OD53BA7FUPI2ZLMRXBLOV0JAPUMCNG--155-300/invoice.json?X-Amz-Expires=3600&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIZJDPLX6D7EHVCKA/20250825/us-west-2/s3/aws4_request&X-Amz-Date=20250825T221242Z&X-Amz-SignedHeaders=host&X-Amz-Signature=0d7a48698f25ce5417216f8fae0f33cd23e08bab59856d60c6e36aba1de2ed5a",
        "body": {
          "others": {
            "notes": ""
          },
          "vendor": {
            "name": "Alpine Data GmbH",
            "address": {
              "city": "Berlin",
              "state": "",
              "country": "Germany",
              "postalCode": "10115",
              "streetAddress": "Falkstr. 12"
            },
            "entityId": "",
            "contactInformation": {
              "fax": "",
              "email": "rechnung@alpinedata.de",
              "phone": ""
            }
          },
          "invoice": {
            "poNo": "",
            "orderNo": "",
            "invoiceNo": "INV-EU-77531",
            "invoiceDate": "2025-08-25",
            "deliveryDate": ""
          },
          "customer": {
            "billTo": {
              "name": "Lucca Fashion S.p.A.",
              "address": {
                "city": "Milano",
                "state": "",
                "country": "Italy",
                "postalCode": "20121",
                "streetAddress": "Via delle Rose 8"
              },
              "entityId": "",
              "contactInformation": {
                "email": "ap@luccafashion.it",
                "phone": ""
              }
            },
            "shipTo": {
              "name": "",
              "address": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "contactInformation": {
                "email": "",
                "phone": ""
              }
            }
          },
          "lineItems": [
            {
              "qty": "5",
              "sku": "SKU-ETL-001",
              "line_total": "€1,500.00",
              "unit_price": "€300.00",
              "description": "ETL Development Hours"
            },
            {
              "qty": "1",
              "sku": "SKU-BI-020",
              "line_total": "€900.00",
              "unit_price": "€900.00",
              "description": "BI Dashboard Package"
            }
          ],
          "customField": {},
          "paymentDetails": {
            "tax": "€456.00",
            "total": "€2,856.00",
            "dueDate": "2025-09-08",
            "discount": "",
            "shipping": "",
            "subtotal": "",
            "paymentTerms": "",
            "bankingInformation": {
              "iban": "",
              "bankCode": "",
              "bankName": "",
              "bankAddress": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "purposeCode": "",
              "branchNumber": "",
              "swiftBicCode": "",
              "accountNumber": "",
              "additionalNotes": "",
              "bankRoutingCode": "",
              "accountHolderName": ""
            }
          }
        },
        "duration": 84,
        "pageCount": 1
      },
      {
        "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/XMG9O1FS7H5WZ6C2R1FF7ZIDUP10VMY9--155-500/invoice.json?X-Amz-Expires=3600&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIZJDPLX6D7EHVCKA/20250825/us-west-2/s3/aws4_request&X-Amz-Date=20250825T221308Z&X-Amz-SignedHeaders=host&X-Amz-Signature=560d7c321b55e2366e065a2b7286bbcae3681012f56e164f5af3ad1b63201212",
        "body": {
          "others": {
            "notes": ""
          },
          "vendor": {
            "name": "Cheshire Analytics Ltd",
            "address": {
              "city": "Manchester",
              "state": "",
              "country": "",
              "postalCode": "M3 2BB",
              "streetAddress": "1 Deansgate"
            },
            "entityId": "",
            "contactInformation": {
              "fax": "",
              "email": "accounts@cheshire-analytics.co.uk",
              "phone": "+44 161 555 2210"
            }
          },
          "invoice": {
            "poNo": "",
            "orderNo": "",
            "invoiceNo": "INV-CH-3921",
            "invoiceDate": "25/08/2025",
            "deliveryDate": ""
          },
          "customer": {
            "billTo": {
              "name": "Brighton Marine Group",
              "address": {
                "city": "Brighton",
                "state": "",
                "country": "",
                "postalCode": "BN1 1AA",
                "streetAddress": "21 Shoreline Rd"
              },
              "entityId": "",
              "contactInformation": {
                "email": "",
                "phone": ""
              }
            },
            "shipTo": {
              "name": "",
              "address": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "contactInformation": {
                "email": "",
                "phone": ""
              }
            }
          },
          "lineItems": [
            {
              "quantity": "1",
              "line_total": "£1,600.00",
              "unit_price": "£1,600.00",
              "description": "Monthly analytics retainer"
            },
            {
              "quantity": "8",
              "line_total": "£680.00",
              "unit_price": "£85.00",
              "description": "Attribution model tuning (hours"
            },
            {
              "quantity": "1",
              "line_total": "£350.00",
              "unit_price": "£350.00",
              "description": "Report pack design"
            }
          ],
          "customField": {},
          "paymentDetails": {
            "tax": "\u00163526.00",
            "total": "\u00163156.00",
            "dueDate": "",
            "discount": "",
            "shipping": "",
            "subtotal": "\u001630.00",
            "paymentTerms": "Net 14",
            "bankingInformation": {
              "iban": "",
              "bankCode": "",
              "bankName": "",
              "bankAddress": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "purposeCode": "",
              "branchNumber": "",
              "swiftBicCode": "",
              "accountNumber": "",
              "additionalNotes": "",
              "bankRoutingCode": "",
              "accountHolderName": ""
            }
          }
        },
        "duration": 88,
        "pageCount": 1
      },
      {
        "url": "https://pdf-temp-files.s3.us-west-2.amazonaws.com/7OLHR4BGLPG4065OZMUJWN9MBH3PBUWE--155-500/invoice.json?X-Amz-Expires=3600&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIZJDPLX6D7EHVCKA/20250825/us-west-2/s3/aws4_request&X-Amz-Date=20250825T221350Z&X-Amz-SignedHeaders=host&X-Amz-Signature=efe0bca321ace6b0cef7eb4067d70017cc3aee5bd08802ed1fd3f77cd06a252e",
        "body": {
          "others": {
            "notes": ""
          },
          "vendor": {
            "name": "Northwind Automation LLC",
            "address": {
              "city": "Austin",
              "state": "TX",
              "country": "",
              "postalCode": "78704",
              "streetAddress": "812 Lakeview Dr"
            },
            "entityId": "",
            "contactInformation": {
              "fax": "",
              "email": "billing@northwind-auto.com",
              "phone": "(512) 555-0129"
            }
          },
          "invoice": {
            "poNo": "PO-88341",
            "orderNo": "",
            "invoiceNo": "NW-2025-1047",
            "invoiceDate": "08/25/2025",
            "deliveryDate": ""
          },
          "customer": {
            "billTo": {
              "name": "Acme Retail Corp",
              "address": {
                "city": "San Francisco",
                "state": "CA",
                "country": "",
                "postalCode": "94105",
                "streetAddress": "77 Market Street"
              },
              "entityId": "",
              "contactInformation": {
                "email": "",
                "phone": ""
              }
            },
            "shipTo": {
              "name": "",
              "address": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "contactInformation": {
                "email": "",
                "phone": ""
              }
            }
          },
          "lineItems": [
            {
              "#": "1",
              "Qty": "1",
              "Line Total": "$2,400.00",
              "Unit Price": "$2,400.00",
              "Description": "Data Pipeline Setup"
            },
            {
              "#": "2",
              "Qty": "12",
              "Line Total": "$1,140.00",
              "Unit Price": "$95.00",
              "Description": "ETL Maintenance (hrs)"
            },
            {
              "#": "3",
              "Qty": "1",
              "Line Total": "$1,250.00",
              "Unit Price": "$1,250.00",
              "Description": "Dashboard Build (flat)"
            }
          ],
          "customField": {},
          "paymentDetails": {
            "tax": "$299.38",
            "total": "$4,989.38",
            "dueDate": "09/08/2025",
            "discount": "-$100.00",
            "shipping": "",
            "subtotal": "$4,790.00",
            "paymentTerms": "",
            "bankingInformation": {
              "iban": "",
              "bankCode": "",
              "bankName": "",
              "bankAddress": {
                "city": "",
                "state": "",
                "country": "",
                "postalCode": "",
                "streetAddress": ""
              },
              "purposeCode": "",
              "branchNumber": "",
              "swiftBicCode": "",
              "accountNumber": "",
              "additionalNotes": "",
              "bankRoutingCode": "",
              "accountHolderName": ""
            }
          }
        },
        "duration": 91,
        "pageCount": 1
      }
    ]
  },
  "connections": {
    "Set Fields": {
      "main": [
        [
          {
            "node": "Store Data in Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to URL": {
      "main": [
        [
          {
            "node": "AI Invoice Parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Invoice ID's": {
      "main": [
        [
          {
            "node": "Convert to URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Invoice Parser": {
      "main": [
        [
          {
            "node": "Set Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Parent Folder ID": {
      "main": [
        [
          {
            "node": "Get Invoice ID's",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Data in Google Sheets": {
      "main": [
        []
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get Parent Folder ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - AI 摘要总结, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量12
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

外部链接
在 n8n.io 查看

分享此工作流