Auto Extract Tables from PDFs and Convert to Excel

Sep 5, 2025·6 Minutes Read

What You'll Have When Done A fully automated system that monitors your Google Drive for new PDF documents, intelligently detects extracts table using PDF.co's advanced table finder feature, extracts the table data into formatted Excel spreadsheets, and saves them to a designated Drive folder for immediate analysis and sharing.

Prerequisites Before you begin, make sure you have:

  • A PDF.co API Key (Get yours here)
  • Google Drive OAuth2 credentials configured in n8n
  • An n8n instance (cloud or self-hosted)
  • A Google Drive folder for incoming PDF documents
  • A Google Drive folder for exported Excel files
  • PDFs containing tabular data (financial reports, data sheets, invoices, etc.)

Quick Start Options

Option A: I Want It Working Now

  1. Import this workflow templateDownload JSON File
  2. Connect your Google Drive account in n8n
  3. Add your PDF.co API key in the HTTP Request node header
  4. Update the Google Drive Trigger with your source folder
  5. Update the Upload file node with your destination folder
  6. Test with a sample PDF containing tables (e.g., a financial report or data sheet)
  7. Activate and let it run

Option B: I Want to Build It Step-by-Step

Follow the 5-step guide below to create the automation from scratch.

What This Automation Does (Overview)

  • Monitors a Google Drive folder for new PDF files
  • Scans PDFs to detect and locate table structures
  • Extracts specific table data with precise coordinates
  • Converts table data into formatted Excel spreadsheets
  • Uploads Excel files to a designated Google Drive folder

Real Example: One document containing a table with 4 table items. Each item extracted per row and table structure maintained. View Sample Files Here.

Step-by-Step Build Guide

Step 1: Monitor for New PDF Documents

Node: Google Drive Trigger

Settings:

  • Trigger On: Changes Involving a Specific Folder
  • Folder From List: Your source folder
  • Watch For: File Created

What This Does: Automatically detects when a new PDF document is added to your designated Google Drive folder.

Success Looks Like: The trigger outputs file metadata (id, name, webContentLink) as soon as a PDF containing tables is uploaded.

Important: The workflow uses webContentLink to access the PDF file, so ensure your Google Drive folder has appropriate sharing permissions.

Step 2: Scan PDF for Table Structures

Node: HTTP Request → PDF.co Find Text in Table with AI

Settings:

  • Method: POST
  • URL: https://api.pdf.co/v1/pdf/find/table
  • Headers:
    • x-api-key: YOUR_PDFCO_API_KEY
    • Content-Type: application/json
  • JSON Body:
{
    "url": "{{ $json.webContentLink }}",
    "async": "false",
    "inline": "true"
}

What This Does: Calls PDF.co's table detection API to scan the PDF and identify all table structures with their exact coordinates.

Success Looks Like: Returns a response containing table locations, dimensions, and metadata for each detected table in the PDF.

You can learn more about Find Text in Table at the API Docs.

Step 3: Extract Specific Table to Excel

Node: PDF.co API → Convert from PDF

Settings:

  • URL: ={{ $('Google Drive Trigger').item.json.webContentLink }}
  • Convert Type: PDF to XLS
  • Advanced Options → Extraction Region: ={{ $json.body.tables[1].rect }}

What This Does: Uses the table coordinates from Step 2 to extract a specific table (tables[1] = second table found) and convert it directly to Excel format.

Success Looks Like: PDF.co returns a download URL for the Excel file containing the extracted table data.

Pro Tip: Change tables[1] to tables[0] for the first table, or tables[2] for the third table, depending on which table you want to extract.

You can learn more about PDF to XLS at the API Docs.

Step 4: Download the Excel File

Node: HTTP Request

Settings:

  • Method: GET
  • URL: ={{ $json.url }}

What This Does: Downloads the generated Excel file from PDF.co's servers.

Success Looks Like: HTTP Request returns the Excel file in binary format, ready for upload to Google Drive.

Step 5: Upload Excel to Google Drive

Node: Google Drive → Upload File

Settings:

  • Input Data Field Name: data
  • Parent Drive From List: My Drive
  • Parent Folder From List: Select your destination folder for Excel files

What This Does: Uploads the extracted table data as an Excel spreadsheet into your designated Google Drive folder.

Success Looks Like: The Excel file appears in your destination folder with the table data properly formatted and ready for analysis.

Congrats! You've created an intelligent workflow that automatically extracts structured data from PDF documents and converts it into analysis-ready Excel spreadsheets. Perfect for processing financial reports, data sheets, invoices, or any document containing tabular information.

Built something cool with this workflow? Share it with us @pdfdotco

Related Tutorials

See Related Tutorials