Note: Make sure the folder contains only the target PDF file with multiple invoices.
Automate Invoice Splitting and Data Extraction Using AI Invoice Parser and Zapier
This tutorial demonstrates how to automate invoice processing using the PDF.co AI Invoice Parser and Zapier. The workflow will:
- Split a multi-invoice PDF into individual invoice files. Extract data from each invoice using PDF.co’s AI Invoice Parser.
- Save the extracted data into a Google Sheets.
Sample Input
A single PDF file containing five invoices (one per page).

Step-by-Step Instructions
IN THIS TUTORIAL
Step 1: Trigger on New File in Google Drive
- App: Google Drive
- Trigger: New File in Folder
- Purpose: Detect when a new PDF file is added to a specific folder.
Step 2: Configure Google Drive
- Drive: Select My Google Drive.
- Folder: Choose the folder where the multi-invoice PDF will be uploaded.

Step 3: Test the Trigger
Run a test to confirm that Zapier detects the uploaded PDF file correctly.

Step 4: Add PDF.co App – Split PDF
- App: PDF.co
- Action Event: Split PDF Into Multiple Files

Step 5: Configure PDF.co Split Action
- File Source: Use the file from Step 3.
- Page Numbers/Ranges: Enter
*
(asterisk) to split all pages into separate files.

Step 6: Test the Split Action
Confirm that each page of the original PDF is split into a separate invoice PDF.

Step 7: Add Looping by Zapier
- App: Looping by Zapier
- Action: Create Loop From Line Items
- Purpose: Iterate through the list of individual invoice URLs.

Step 8: Configure Looping
- Values to Loop: Use the output array of URLs from the Split PDF action.

Step 9: Test the Looping Setup
Run a test to ensure that each invoice PDF is processed in the loop.

Step 10: Add PDF.co AI Invoice Parser
- App: PDF.co
- Action Event: AI Invoice Parser

Step 11: Configure Invoice Parser
- Source File URL: Use the invoice file URL from the looping step.
- Custom Fields: Specify any additional fields not included in the common schema that should appear in the output.
Note: Refer to the AI Invoice Parser API Docs for details on custom field configuration.

Step 12: Test the Invoice Parser
Verify that the parser extracts key invoice data correctly from each file.

Step 13: Add Code by Zapier
- App: Code by Zapier
- Action Event: Run Python
- Purpose: Format the table items for easy mapping to Google Sheets
Step 14: Configure Run Python
- Input Data: Provide values for the required variable and include the output URL from the previous step.
- Code: Use the code below:
import requests
# Get the URL passed into this code step
url = input_data['json_url']
# Fetch and parse JSON
response = requests.get(url)
data = response.json()
# Extract all line items
line_items = data.get('lineItems', [])
# Return the full list of line items
return {
"line_items": line_items
}

Step 15: Test the Python Code
This step returns the table items, which can be easily mapped to Google Sheets.

Step 16: Add Google Sheets Action
- App: Google Sheets
- Action Event: Create Multiple Spreadsheet Rows
Step 17: Configure Google Sheets Integration
- Drive: My Google Drive
- Spreadsheet: Select the target sheet
- Worksheet: Choose the relevant tab
- Data Mapping: Map each extracted invoice field to a corresponding column in the spreadsheet



Step 18: Test & Publish the Zap
- Run a test to make sure invoice data is added to the spreadsheet.
- Once confirmed, publish the Zap to go live.

Step 19: Review Results in Google Sheets
Open your Google Sheet and confirm that invoice data is populated correctly into separate rows.

Result Summary
You have successfully automated your invoice processing pipeline using:
- PDF.co to split and parse invoices
- Zapier to handle workflow automation
- Google Sheets to store extracted invoice data
Related Tutorials
