Bills Into the Books on Microsoft 365
An intake library, four lists and one flow that key every bill, receipt and invoice into your accounts as a draft with the PDF attached, and hold anything unclear for you with the reason.
Used by
- Business Systems Analyst
- Bookkeeper
- Accounts Officer
How to get this live in your business
Bills come in by email, receipts as photos and the odd invoice on paper, and someone keys them into Xero or MYOB one at a time. This plan puts them all in one SharePoint library and runs one flow on each. It finds the supplier by ABN, codes the lines the way you already code that supplier, checks the figures add up, and writes a draft with the PDF attached. Anything it cannot place lands on a list for you.
In short
What this is
A build plan for the Ledger Entry standard on Microsoft 365. One library, four lists and one flow beside the accounts software you already run, Xero or MYOB Business, connected through its own sign-in.
The core rule
The flow only ever writes drafts. A person approves each one in your accounts, and works every exception on the list.
What it does not do
It never approves, posts, pays or sends, never creates a contact, never changes a printed figure, and never guesses an account or a missing date.
The hard part
Keying each document once when the same PDF arrives twice, and reading your accounts for the file's key before trying again after a timeout.
Take the spec to Claude, ChatGPT or Copilot. The sentence to paste is one click away.
Want the whole thing by email?
This paper, plus the rest of the library. One click to stop them.
1. Before you start
Read the ledger entry build standard first. It defines its objects, and the lists below are those objects with SharePoint types on them. Shared conventions are in building the standards on Microsoft 365.
Fill Settings with your accounts software, how many past bills must agree before the flow codes from them (three to start), and the person who works the exceptions. Add a CodingRules row for every supplier you code the same way every time. Run it beside whoever keys bills now for two weeks and compare the drafts.
Check that each supplier record in your accounts has its ABN. The flow matches on it, so a supplier with no ABN on file lands on the Exceptions list until someone adds it.
2. The lists, with their columns
For your developer. Show the fields for your developer
Site: LedgerEntry
LIST EntryLog (one row per document that arrives, written by Flow 1)
FileHash Text indexed, UNIQUE, REQUIRED. the file's sha256: the key the draft is written under
FileLink Hyperlink REQUIRED. the document in the Intake library
Kind Choice REQUIRED. supplier_bill | supplier_credit
| receipt | sales_invoice
ContactId Text indexed. the ledger's contact id, matched by ABN or a known sender address
Number Text indexed. as printed
Total Currency as printed
Result Choice indexed, REQUIRED. drafted | held
LedgerId Text the draft's id in the ledger
LIST Exceptions (one row per document held for a person)
FileHash Text indexed, REQUIRED
Reason Choice indexed, REQUIRED. unreadable
| unknown_contact | already_in_ledger | totals_do_not_add | no_coding | gst_mismatch
Detail Note REQUIRED. what was found and what to do, with both figures where they differ
Missing Text unreadable: the fields that could not be read
ExistingLedgerId Text already_in_ledger: the record it matches
Owner Person REQUIRED
ClosedBy Person filled by the person, never by a flow
ClosedOn DateTime
LIST CodingRules (one row per contact. A person keeps it.)
ContactId Text indexed, UNIQUE, REQUIRED
ContactName Text
AccountCode Text REQUIRED
TaxCode Text REQUIRED
LIST Settings (one row. A person keeps it.)
Ledger Choice indexed, REQUIRED. Xero | MYOB Business
HistoryCount Number REQUIRED. posted documents that must agree before their coding is used: 3 to start
Owner Person REQUIRED. who works the exceptions
The ledger is not in this site. The flow reads contacts, the chart, tax rates and posted history through the ledger's own connector and sign-in, writes each document as a draft with its source attached, and never approves, posts, pays, sends or creates a contact.EntryLog.FileHash is unique and read before every write, so the same PDF is keyed once. ClosedBy is a person column the flow never fills.
3. Every rule, and what enforces it
| The rule | Enforced by | How |
|---|---|---|
| Every document accounted for | EntryLog, one row per file | Each file in the Intake library ends as drafted or held. A file with no EntryLog row after a run is the flow's own failure, and shows in the run history. |
| Matched by ABN, never by name | EntryLog.ContactId, Exceptions unknown_contact | The ABN read off the document, digits only, against the contacts' ABNs; with none on the document, the sender's address against the contacts' emails. Not exactly one match: held. |
| Coded your way | CodingRules, Exceptions no_coding | The contact's CodingRules row, or its last HistoryCount posted bills when all used the same account and tax code. Otherwise held. |
| Figures as printed, GST from your rates | Exceptions totals_do_not_add, gst_mismatch | Lines plus GST must equal the printed total to the cent; tax per line from the ledger's rate must be within a cent a line of the printed GST. |
| Keyed once | EntryLog.FileHash, Exceptions already_in_ledger | Before each write, and before any retry, the flow looks for the file's hash in EntryLog and in the ledger, and for the same contact and number in the ledger. |
| Drafts only, source attached | EntryLog.LedgerId | The create call always sends the draft status. The file is attached to the draft it became, then the EntryLog row is written. |
4. The flow
For your developer. Show the fields for your developer
FLOW Key it in (a file lands in Intake)
hash the file -> FileHash
read the fields off the document (AI Builder
or a document model): ABN, name, number,
date, due date, lines, GST, total
missing date, number, lines, GST or total
-> Exceptions unreadable, with what is missing
match ABN against contact ABNs, else sender
address against contact emails
not exactly one -> unknown_contact
look FileHash in EntryLog and the ledger;
same contact and number in the ledger
found -> already_in_ledger, with its id
add lines + GST = total, to the cent
no -> totals_do_not_add, both figures
code CodingRules row, else last HistoryCount
posted bills all the same
neither -> no_coding
tax each line from the ledger's own rate,
within a cent a line of the printed GST
no -> gst_mismatch, both figures
write one draft through the ledger connector
no answer -> read the ledger for FileHash
before any retry
attach the file to the draft
log EntryLog row: drafted, LedgerId
never approve, post, pay, send, or create a
contactThe flow has no step that approves, posts or creates a contact. Approving drafts and working exceptions are the person's.
5. What the flow can reach in your Microsoft 365 and your accounts
The flow keys each bill, receipt and invoice into your accounts as a draft. It reads your contacts, chart of accounts, tax rates and each supplier’s past bills, writes one draft per document with the PDF attached, and puts anything it cannot place on the Exceptions list for you.
- Your accounts software, through its own connector. Read contacts, accounts, tax rates, posted bills; create draft bills, credit notes and invoices; attach files. Nothing else.
- SharePoint, the LedgerEntry site. Read on the Intake library, CodingRules and Settings; contribute on EntryLog and Exceptions.
- Outlook, the accounts mailbox. Save attachments into the Intake library, and nothing else.
How to cut it off. Turn the flow off. Revoke the connection on your accounts software’s own connected apps page and it stops writing.
6. The order to build it in
- Create the LedgerEntry site, the Intake library, the four lists and a connection to your accounts as a service account.
- Build the flow and drop in last week's bills: compare each draft with the one keyed by hand.
- Drop in a bill from a supplier not in your accounts: it lands on Exceptions, and no contact is created.
- Drop the same PDF in twice: one draft, one already_in_ledger exception.
- Change a total on a test PDF so it does not add up: held with both figures.
- Turn the ledger connection off mid-write and run it again: still one draft.
7. Three traps specific to this build
Matching on the name printed on the bill
Two businesses can trade under the same name, and an invoicing service can send on a supplier's behalf. Match on the ABN, or on a sender address already on the contact, and hold the rest.
Letting the reader fix the maths
A document model that returns a total worked out from the lines hides a supplier's mistake. Keep the figure as printed and compare it, so a bill that does not add up comes to a person.
Retrying after a timeout
A create call that times out has often landed. Read the ledger for the file's key before trying again, or the bill goes in twice.
8. Where the automation stops
- Approving each draft in your accounts, by name.
- Every document on the Exceptions list, with the reason.
- Adding a new contact, and a coding rule for a supplier with no agreeing history.
- Asking a supplier for a corrected invoice.
The pass test. In a test file of your own accounts. Drop in clean bills for suppliers with a coding rule or history, and one document for each exception: no matching contact, totals that do not add up, wrong GST, no date, already keyed by hand, and a forwarded copy. Run the flow twice. Every clean bill is one draft with its PDF attached, every other document is on the Exceptions list with its reason, and your accounts show nothing approved, no new contact and nothing keyed twice.