Why re-imports duplicate documents
A CSV or API-based import that only ever creates records has no concept of "this row is the same invoice as last time." Fix a typo in a line description, re-run the same file, and you get a second invoice sitting next to the first, both with the same customer and a similar total. Multiply that by a spreadsheet with fifty rows and a couple of correction passes, and the duplicates are hard to spot until someone reconciles the customer's account.
The document number is the match key
An invoice or bill import that supports updates needs to treat the invoice number (or, for a bill, the supplier's own invoice number entered as the bill number) as a lookup key against the organisation's existing documents, not just a label. When that number already exists in Xero, the import should update the existing document's lines rather than create a new one. When it doesn't, it creates fresh. Leaving the number blank on a sales invoice and letting Xero auto-assign one sidesteps the whole question, at the cost of never being able to re-target that specific invoice later.
Not every document is safe to update
A document's status in Xero determines whether an update by number match is safe at all:
- Draft and submitted documents are the only ones where replacing the lines by a number match is appropriate. Nothing downstream depends on them yet.
- Authorised documents have already affected the ledger. Overwriting their lines silently would change numbers someone may have already relied on.
- Paid and voided documents are effectively closed. An import should never touch them, full stop.
An import path that updates by number match regardless of status will eventually rewrite something that should have stayed fixed. Restricting updates to draft and submitted documents, and treating everything past that as read-only from the spreadsheet's point of view, is what makes repeated imports safe.
Checking a re-import before it runs
- Look up the document number against Xero's live records and note its current status.
- If it's draft or submitted, treat the row as an update: confirm the new lines are what you actually intend to replace the old ones with.
- If it's authorised, paid, or voided, don't attempt to import over it. Make the correction directly in Xero instead.
- After the import, spot-check that the document count in Xero matches what you expected, not one higher per row you thought you were only correcting.
Setting up the import in the first place
See how to bulk import invoices into Xero from a spreadsheet or how to bulk import bills into Xero from a spreadsheet for how to lay out the sheet before this question comes up.
Only draft and submitted documents are ever updated
Bulk Importer for Xero matches invoices and bills by number against your live organisation and updates only draft or submitted documents. Authorised and paid records are never modified, so a correction pass never turns into a duplicate. It's built by Cody Labs and is not affiliated with Xero.
See Bulk Importer for Xero