Invoice PDFs into an Excel list

Takes a folder of Japanese invoice PDFs and produces an Excel list and a payment schedule. Every amount it reads is re-calculated; anything that doesn't add up is marked “Review” with the reason.

Input
Invoice PDFs (with selectable text)
Output
One Excel file with 3 sheets: the list and the payment schedule
Checks
12 checks, including consumption tax, duplicate billing, and registration numbers

The invoices it read

Seven invoices from four fictitious vendors, each vendor with its own layout. All but 02 contain a deliberate problem, such as duplicate billing or wrong tax.

Invoice PDF: 01 Ruled table
01 Ruled table
Invoice PDF: 02 Japanese era dates and full-width digits; 10% and 8% tax on one invoice
02 Japanese era dates and full-width digits; 10% and 8% tax on one invoice
Invoice PDF: 03 Letter-style layout; era date written as R8.10.05
03 Letter-style layout; era date written as R8.10.05
Invoice PDF: 07 Values on the line below each heading
07 Values on the line below each heading

Of the other three, 04 uses the same layout as 02, 05 is a reissue of 01, and 06 is a PDF with no text (standing in for a scan). Click an image to open the PDF.

The Excel it produced

Of 7 invoices, 1 came out OK and 6 were marked for review, each with a reason. The tables below are translated from the Japanese output.

List sheet

FileVendorInvoice no.TotalResultReason for review
01_sample-shoji_SS-2026-0931.pdfSample Shoji Co., Ltd.SS-2026-0931¥99,000ReviewPossible duplicate: the same vendor and invoice no. SS-2026-0931 also appear in 05_sample-shoji_SS-2026-0931_resend.pdf
02_kaku-systems_KS-0457.pdfKaku Systems LLCKS-0457¥164,960OK
03_design-kobo_DK-26-015.pdfDesign Kobo Sample (fictitious)DK-26-015¥53,000Review10% consumption tax of ¥5,000 does not match ¥48,000 × 10% = ¥4,800 (off by more than the ¥1 rounding allowance)
04_kaku-systems_KS-0471.pdfKaku Systems LLCKS-0471¥88,000ReviewDue date 2026/09/10 is before the issue date 2026/10/10
05_sample-shoji_SS-2026-0931_resend.pdfSample Shoji Co., Ltd.SS-2026-0931¥99,000ReviewPossible duplicate: the same vendor and invoice no. SS-2026-0931 also appear in 01_sample-shoji_SS-2026-0931.pdf
06_scanned_no-text.pdfReviewNo text can be extracted from the PDF (probably a scanned image; OCR is out of scope)
07_kaku-unyu_KU-1103.pdfKaku Unyu Co., Ltd.KU-1103ReviewCould not read: issue date, due date, total

Columns such as issue date, due date, subtotal, tax, and registration number are omitted here. Due dates are on the payment schedule below.

Payment schedule sheet

Sorted by due date, with the days left until a reference date (here 2026/10/15). Overdue is red; due within 7 days is yellow.

Due dateDays left (as of 2026/10/15)StatusVendorInvoice no.TotalResult
2026/09/10-35OverdueKaku Systems LLCKS-0471¥88,000Review
2026/10/205Due within 7 daysKaku Systems LLCKS-0457¥164,960OK
2026/10/3116Sample Shoji Co., Ltd.SS-2026-0931¥99,000Review
2026/10/3116Sample Shoji Co., Ltd.SS-2026-0931¥99,000Review
2026/11/3046Design Kobo Sample (fictitious)DK-26-015¥53,000Review
Due date unknownReview
Due date unknownKaku Unyu Co., Ltd.KU-1103Review

The file name column is omitted.

Download this Excel file (original, in Japanese, all columns)10KB

What it checks

If any of these fails, the invoice is marked for review with the reason.

For tax, a difference of up to ¥1 is accepted, since rounding down, up, or to nearest are all in use. The registration number is the one required under Japan's qualified invoice system; its check digit is verified with the corporate number formula set out by the National Tax Agency and the ministerial ordinance.

How it uses AI

Only the fields the rules could not read are passed to AI (Claude). Each value AI returns is matched against the text actually in the PDF, and only values that match are used. They then go through the same checks as values read by the rules.

The Excel above was produced with AI turned off, so 07 is marked for review. In a separate run with AI turned on, AI filled in the issue date, due date, and total for 07, the checks passed, and 07 came out OK. The “Read by” column then shows which fields AI filled in.

AI is optional on every run. When it is on, the text of the PDFs concerned is sent to Anthropic. When it is off, nothing leaves the machine.

Limitations

Technology

A command-line tool in Python 3.10, using pdfplumber to read PDFs and openpyxl to write Excel. 151 tests; tested on macOS.