sturdybits

Guides / Name Documents

How to rename invoice PDFs automatically by date, supplier and invoice number

30 November 2026

To rename invoice PDFs automatically, something has to read each invoice, find its date, supplier and invoice number, and build a new name from them, such as "2026-11-30 Kestrel IT Ltd - KIT-7781.pdf". On Windows you can build that for free in Power Automate for desktop, and programmers can script it, but both need a rule for each supplier's layout, so for a few invoices a month, renaming by hand is quicker.

Decide on the name first

Pick one pattern and keep to it. The date written year first, then the supplier, then the invoice number keeps a folder in date order and makes each file easy to match to your books. Our file naming convention for invoices and receipts explains why, and which characters to leave out.

Why invoices are harder than other PDFs

1. Rename by hand

Good for: a few invoices a month.

Open each invoice, note the date, supplier and number, then close it and rename the file: select it and press F2 in File Explorer, or Return in Finder on a Mac, where the Space bar previews it with Quick Look. Copy the invoice number from the PDF rather than retyping it, and check each name.

2. Build a flow in Power Automate for desktop

Good for: Windows users with a handful of regular suppliers, happy to write text patterns.

Microsoft's automation app is free on Windows 10 and 11. A flow for invoices uses these actions, and Microsoft's reference pages cover the PDF, text and file ones:

  1. Get files in folder, with the file filter *.pdf, then a For each loop over the files.
  2. Extract text from PDF, with Page(s) to extract set to Single and page 1.
  3. Parse text with Is regular expression and Ignore case switched on, once for each value. For example, (?<=Invoice (no|number)\W+)[A-Z0-9/-]+ finds the number after "Invoice no" or "Invoice number".
  4. Convert text to datetime, with a custom format such as dd/MM/yyyy if needed, then Convert datetime to text with the custom format yyyy-MM-dd, so every date is written the same way.
  5. Replace text to swap any / in the invoice number for -.
  6. Rename file(s) with Set new name, such as %DateText% %Supplier% - %InvoiceNo% with your own variable names. Leave If file exists on Do nothing, the default, so a repeated name can't replace another invoice.

The supplier is the hardest value, as it rarely has a label: the simplest answer is a folder per supplier, with the supplier's name typed into the flow. Expect to adjust the patterns whenever a supplier changes its layout, and check the results, as a pattern can pick up the wrong text. Scanned invoices need its separate OCR actions too.

On a Mac, the Shortcuts app has Get Text from PDF, Match Text and Rename File actions, so the same approach works there.

3. Write a script

Good for: people who write code.

A script does the same job: read the first page's text with a PDF library such as pypdf, find each value with a pattern, write the date as 2026-11-30, check the new name isn't taken, then rename. Our guide to renaming PDFs from their content has a short Python example. For invoices you'll need a pattern for each supplier's labels and a way to read each supplier's date style. pypdf doesn't do OCR, so scans need it first.

4. Use a document manager or bookkeeping service

Good for: filing every document, if you'll set up or pay for a system.

When a tool is quicker

Flows and scripts need a rule for every supplier, and services need your invoices uploaded. Name Documents does it on your own computer. Drop in the PDFs, a folder or a .zip, and click the date, the supplier and the invoice number on one of them. It finds the same values in every other PDF by their label, however it's written ("Invoice no", "Invoice number", "Inv #"), by their place on the page or by what they look like, and writes every date the same way, such as 2026-11-30. Every new name is listed before anything is saved, with anything not found marked, and you can change any name by typing. Characters file names can't contain are replaced, and a repeated name gets a number, so nothing is overwritten. Download renamed copies in a .zip with an index of old and new names, or, in Chrome and Edge, rename the PDFs in their folder, with undo.

It needs PDFs with text it can read, such as invoices from accounts software or online shops. Scanned invoices are marked so you can type their names, and PDFs that need a password to open are left out.

It runs in your browser and your files never leave your computer. The free version renames up to 10 PDFs at a time; Pro is £19 once and renames any number. You can try it with sample invoices first.

Quick answers

Can Windows rename PDFs from the invoice number by itself? Not from File Explorer. Power Automate for desktop, free on Windows 10 and 11, can do it with a flow that reads each PDF's text and renames the file.

What order should the parts of an invoice file name go in? Date first, written year first (2026-11-30), then the supplier, then the invoice number. They then sort into date order.

Why does my flow find no text in some invoices? They're probably scans or photos, which are pictures of text. Run OCR on them first, then try again.