You can learn more about secure file uploads in the PDF.co API Docs.
Secure Bank Statement Processing: PDF to CSV with Auto Cleanup
What You'll Have When Done: A secure, webhook-triggered automation that receives bank statement PDFs, converts them to structured CSV format using PDF.co's advanced processing, and automatically saves them to Google Drive with proper cleanup - perfect for financial data processing, accounting workflows, and secure document management.
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 processed CSV files
- Bank statement PDFs or similar financial documents
- Basic understanding of webhook endpoints
Quick Start Options
Option A: I Want It Working Now
- Import this workflow template → Download JSON File
- Connect your Google Drive account in n8n
- Add your PDF.co API key in the HTTP Request nodes
- Update the Upload file node with your destination folder
- Copy the webhook URL from the Webhook node
- Test with a sample bank statement PDF via POST request
- Activate and start processing
Option B: I Want to Build It Step-by-Step
Follow the 9-step guide below to create the secure automation from scratch.
What This Automation Does (Overview)
- Receives PDF files securely via webhook endpoint
- Uploads PDFs to PDF.co using presigned URLs for security
- Converts bank statements and financial documents to structured CSV
- Downloads processed CSV files automatically
- Saves CSV files to designated Google Drive folder
- Cleans up temporary files from PDF.co servers
- Maintains data security throughout the entire process
Step-by-Step Build Guide
Step 1: Create Secure Webhook Endpoint
Node: Webhook
Settings:
- HTTP Method:
POST
- Path: Copy unique webhook path
What This Does: Creates a secure endpoint to receive PDF files for processing. The webhook accepts file uploads and triggers the entire conversion workflow.
Success Looks Like: The webhook returns a unique URL that you can use to POST PDF files for processing.
Step 2: Get Secure Upload URL
Node: HTTP Request → PDF.co File Upload
Settings:
- Method:
POST
- URL:
https://api.pdf.co/v1/file/upload/get-presigned-url
- Headers:
x-api-key
: YOUR_PDFCO_API_KEY
- Body Parameters:
name: sample.pdf
What This Does: Requests a secure, presigned URL from PDF.co for uploading your PDF file. This approach ensures secure file transfer without exposing your API key in file URLs.
Success Looks Like: Returns a JSON response containing a presigned URL and a file URL for secure file transfer.
Step 3: Merge Data Streams
Node: Merge
Settings:
- Mode:
Combine
- Combine By:
All Possible Combination
What This Does: Combines the original webhook data (containing the PDF file) with the presigned URL data, ensuring both pieces of information are available for the upload step.
Success Looks Like: Output contains both the PDF file data and the secure upload URL information.
Step 4: Upload PDF Securely
Node: HTTP Request → PDF.co File Upload
Settings:
- Method:
PUT
- URL:
={{ $json.presignedUrl }}
- Body Content Type:
Form-Data
- Body Parameters:
- Parameter Type:
n8n Binary File
- Name:
file
- Input Data Field Name:
data
- Parameter Type:
What This Does: Securely uploads the PDF file to PDF.co's servers using the presigned URL. This method ensures secure transfer without exposing sensitive data.
Success Looks Like: Successful upload confirmation, making the PDF available for processing on PDF.co servers.
Step 5: Convert PDF to CSV
Node: PDF.co API → Convert from PDF
Settings:
- URL:
={{ $('GET - HTTP Request').item.json.url }}
- Convert Type:
PDF to CSV
- Advanced Options → Inline:
False
What This Does: Processes the uploaded PDF and converts it to structured CSV format.
Success Looks Like: PDF.co returns a download URL for the processed CSV file containing your structured bank statement data.
You can learn more about PDF to CSV conversion at the API Docs.
Step 6: Download Processed CSV
Node: HTTP Request
Settings:
- Method:
GET
- URL:
={{ $json.url }}
- Response Format:
File
- Put Output in Field:
data
What This Does: Downloads the converted CSV file from PDF.co's servers in binary format, ready for storage or further processing.
Success Looks Like: HTTP Request returns the CSV file data, containing your structured bank statement information.
Step 7: Save to Google Drive
Node: Google Drive → Upload File
Settings:
- Input Data Field Name:
data
- Parent Drive: My Drive
- Parent Folder: Select your destination folder for CSV files
What This Does: Uploads the processed CSV file to your designated Google Drive folder, making it immediately available for analysis, sharing, or import into accounting software.
Success Looks Like: The CSV file appears in your Google Drive folder with bank statement data properly structured and ready for use.
Step 8: Cleanup PDF Files
Node: HTTP Request → PDF.co Delete File
Settings:
- Method:
POST
- URL:
https://api.pdf.co/v1/file/delete
- Headers:
x-api-key
: YOUR_PDFCO_API_KEY
- Body Parameters:
url: ={{ $('GET - HTTP Request').item.json.url }}
What This Does: Securely deletes the PDF file from PDF.co's servers.
Success Looks Like: Confirmation that temporary files have been deleted, completing the secure processing cycle.
You can learn more about Delete Temporary Files at the API Docs.
Step 9: Cleanup CSV Files
Node: HTTP Request → PDF.co Delete File
Settings:
- Method:
POST
- URL:
https://api.pdf.co/v1/file/delete
- Headers:
x-api-key
: YOUR_PDFCO_API_KEY
- Body Parameters:
url: ={{ $('PDFco Api').item.json.url }}
What This Does: Securely deletes the temporary CSV file from PDF.co's servers after successful upload to Google Drive, ensuring no sensitive financial data remains on external servers.
Success Looks Like: Confirmation that temporary files have been deleted, completing the secure processing cycle.
Congrats! You've created a secure, automated system for processing bank statements and financial PDFs. Your workflow now handles file uploads, conversion, storage, and comprehensive cleanup automatically while maintaining high security standards for sensitive financial data.
Built something cool with this workflow? Share it with us @pdfdotco
Related Tutorials



