All Mini Tutorials

AI Does It For You

Turn a Folder of Invoice PDFs Into a Spreadsheet With AI

Let an AI coding agent read a folder of invoice PDFs and create a new spreadsheet-ready CSV with invoice numbers, dates, suppliers and totals while leaving every original PDF untouched.

5 minBeginnerPDFs, Excel, Small Business, FilesCodex / Claude Code

The problem

You may have dozens of invoice PDFs and need a simple list showing the supplier, invoice number, invoice date, amount, VAT and total. Typing this into Excel manually is slow and easy to get wrong. An AI coding agent can inspect the invoice files and create a new spreadsheet-ready CSV for you. A CSV is a simple spreadsheet file that Excel can open. The important rules are: do not touch the original invoices, do not guess missing numbers, and test a few invoices before processing the whole folder.

What you need

  • Codex or Claude Code
  • A folder containing invoice PDFs
  • Excel or another spreadsheet app to open the final CSV

Safety first

Invoices may contain customer details, supplier details, bank details, tax/VAT information, addresses and financial information. Only process invoices you are authorised to use with the chosen AI setup. The agent must not modify, rename, move, delete or overwrite any PDF. All extracted information must go into a NEW output file. NEVER GUESS A VALUE: if something cannot be read confidently, use UNREADABLE or leave the field blank where appropriate. AI CAN READ A NUMBER WRONG. For example, R8,000.00 could theoretically be misread as R6,000.00, especially on a poor scan. Always spot-check financial values before relying on the spreadsheet.

Copy-paste prompt

I have a folder containing invoice PDF files: [FOLDER PATH] I want you to extract invoice information into a NEW CSV file that I can open in Excel. IMPORTANT SAFETY RULES: - Do not modify the original PDFs. - Do not rename the original PDFs. - Do not move the original PDFs. - Do not delete anything. - Do not overwrite anything. - Keep the original invoice folder unchanged. Create these CSV columns: 1. Source Filename 2. Invoice Number 3. Supplier / Business 4. Invoice Date 5. Due Date 6. Subtotal 7. Tax / VAT 8. Total 9. Currency DATA QUALITY RULES: - Never guess a value. - If a field is genuinely missing, leave it blank. - If something appears present but cannot be read reliably, write UNREADABLE. - Keep numbers exactly as they appear unless normalising a date or currency format is clearly safe. - Preserve the source filename for every row. FIRST: Process only 3 sample invoices. Show me a preview table of the extracted results. Also report: - anything you could not read; - any invoices with unusual layouts; - any fields you are uncertain about. Then STOP. Do not process the rest of the folder until I explicitly approve the sample.

When you are ready to approve

Approval prompt

I have reviewed the 3 sample invoices and the extraction looks correct. Now process the remaining invoice PDFs using the same rules. Create a NEW CSV file. Keep these rules: - do not modify any original PDFs; - do not rename or move any PDFs; - do not guess values; - use UNREADABLE where necessary; - keep Source Filename for every row. After processing, report: 1. number of PDFs processed; 2. number of rows created; 3. invoices containing unreadable fields; 4. invoices skipped or failed; 5. location/name of the new CSV file.

Steps

  1. Put the invoice PDFs you want to process into one folder. Do not use your only copy if the files are important.
  2. Give Codex or Claude Code access to that folder using the normal workflow for the tool. You do not need to write code or install extra software.
  3. Paste the first supplied prompt. Replace [FOLDER PATH] with the real folder location.
  4. CHECK THE 3-ROW SAMPLE. Open or inspect the preview and compare each extracted row with its original invoice. Check especially the invoice number, date, VAT/tax, total and currency. This is the most important step. For example, INV-1048-Supplier-A.pdf might produce: INV-1048-Supplier-A.pdf | INV-1048 | ABC Supplies | 15 Aug 2026 | | R1,000.00 | R150.00 | R1,150.00 | ZAR. Some PDFs contain real selectable text, while others are effectively photographs or scans of paper. Scanned invoices can be harder to read; if the agent cannot reliably extract a field, it should use UNREADABLE instead of guessing.
  5. Only when the sample looks correct, paste the approval prompt. Then open the resulting CSV in Excel. Keep Source Filename as the first column: it lets you trace every spreadsheet row back to the original invoice.

What success looks like

Before: you have a folder containing many separate invoice PDFs. After: you still have exactly the same invoice PDFs untouched, plus a NEW CSV that looks roughly like: Source Filename | Invoice Number | Supplier | Date | VAT | Total; invoice-001.pdf | INV-001 | ABC Supplies | 01 Aug 2026 | R150 | R1,150; invoice-002.pdf | INV-002 | XYZ Services | 04 Aug 2026 | R300 | R2,300. The spreadsheet is a convenience copy of extracted information. The original invoice remains the source you should check when accuracy matters.

If it goes wrong

Stop processing invoices. Do not change the original PDFs. The sample extraction contains mistakes. For each sample invoice: 1. compare the extracted row against the original PDF again; 2. identify exactly which fields were wrong; 3. explain why the mistake may have happened; 4. propose a safer extraction rule. Do not process additional invoices yet. Show me a corrected 3-invoice sample and STOP for approval. If only one specific field is problematic, ask the agent to narrow the retry to that field rather than redoing everything.

Next useful tutorial

Clean a Messy Customer Spreadsheet With AIFind Duplicate Customers in Excel With AI
Turn Invoice PDFs Into a Spreadsheet With AI | NonDevApps