Skip to main content
Build an agent that extracts structured data from receipts for expense tracking.

What you’ll build

A receipt processor that:
  1. Finds receipt emails and documents
  2. Extracts vendor, amount, date, and category
  3. Outputs structured data for expense reports

Prerequisites

  • Airstore installed and authenticated
  • Gmail and/or Google Drive connected
  • Claude Code installed

Step 1: Create smart folders for receipts

# Receipt emails
airstore create sources/gmail/receipts \
  --query "emails with 'receipt' or 'invoice' in subject with attachments"

# Receipt PDFs from Drive
airstore create sources/gdrive/receipts \
  --query "PDF files with 'receipt' or 'invoice' in name from 2024"

Step 2: Mount and process

airstore mount ~/airstore
cd ~/airstore/sources/gmail/receipts

Step 3: Extract receipt data

claude "Extract data from these receipts. For each one, output:
- Vendor name
- Amount (with currency)
- Date
- Category (travel, software, meals, office, other)
- Payment method if visible

Format as a CSV with headers."

Example output

vendor,amount,date,category,payment_method
Amazon Web Services,USD 127.43,2024-01-15,software,credit card
Delta Airlines,USD 342.00,2024-01-10,travel,corporate card
Uber,USD 24.50,2024-01-14,travel,credit card
Zoom,USD 14.99,2024-01-01,software,credit card
Sweetgreen,USD 18.75,2024-01-12,meals,credit card

Automating expense reports

Create a monthly expense report:
#!/bin/bash
# monthly-expenses.sh

MONTH=$(date +%B)
YEAR=$(date +%Y)

# Update receipt queries for current month
airstore update sources/gmail/receipts \
  --query "receipt emails from $MONTH $YEAR"

airstore sync sources/gmail/receipts

# Generate report
cd ~/airstore/sources/gmail/receipts

claude "Create an expense report for $MONTH $YEAR:
1. List all expenses as CSV
2. Calculate totals by category
3. Flag any unusual or large expenses
4. Note any missing information" > ~/expenses-$MONTH.md

Combining email and Drive receipts

Process receipts from multiple sources:
cd ~/airstore/sources

claude "Process all receipts from:
- gmail/receipts/ (email receipts)
- gdrive/receipts/ (PDF receipts)

Deduplicate by vendor+date+amount.
Output a consolidated CSV."

Categorization rules

Train Claude with your categories:
claude "Extract receipt data using these categories:
- travel: flights, hotels, uber, trains
- software: SaaS subscriptions, cloud services
- meals: restaurants, food delivery
- office: supplies, equipment
- professional: conferences, training
- other: anything else

Flag items over $500 for review."

Integration with accounting

Export to accounting software format:
claude "Extract receipts and format for QuickBooks import:
- Date (MM/DD/YYYY)
- Vendor
- Amount
- Account (map categories to chart of accounts)
- Memo (brief description)

Output as QBO-compatible CSV."

Handling attachments

For receipts with PDF attachments:
# Gmail attachments are included in .eml files
# Claude can read the attachment content

cd ~/airstore/sources/gmail/receipts

claude "For each email:
1. Read the attached PDF receipt
2. Extract vendor, amount, date
3. If no attachment, extract from email body"

Flagging duplicates

Identify potential duplicate expenses:
claude "Review these receipts and flag potential duplicates:
- Same vendor + same amount within 3 days
- Same amount from different vendors on same day

List flagged items for manual review."

Next steps