Skip to content
Mehdi Messaoudene

Importing Excel or CSV with preview and exact undo

Mehdi Messaoudene1 min readAutomation and data

Two pastel pink cylinders and a ring, evoking a batch that can be undone

A data import must be reversible. Suivi Commercial first shows a preview with the matches, files rows into a draft batch, writes only on confirmation and can undo exactly, including restoring the sales an import had replaced. All of it runs in transactions.

In short
  • Preview and matching before any write.
  • Draft batches, confirmed explicitly.
  • Exact undo: replaced sales are restored.
  • Import and seed can be replayed without overwriting the administrator's changes.

The problem with imports

Importing a file is easy; undoing it is much harder. Suivi Commercial, a sales-tracking tool, treats Excel and CSV imports as operations that must be controllable from end to end.

Preview, batch, confirmation

The file is first shown as a preview, with the proposed matches (customers, products). Rows are then filed into a draft batch. Nothing enters the figures before confirmation, and the write happens in a transaction.

Undoing exactly

An import can replace a period. Undoing does not just delete: it restores the replaced sales. That restoration was checked on samples of customers, sales and targets.

Replayable without damage

The initial load (calendar, reference data, administrator account) is idempotent: run again, it duplicates nothing and keeps the changes made by the administrator. This behaviour is tested on an isolated PostgreSQL database.

Limits

These checks were done locally. No external deployment was made.

Frequently asked questions

What if the import gets it wrong?

The batch can be undone: the replaced period is given back as it was, which was checked on samples of customers, sales and targets.

Can the initial data load be replayed?

Yes, the seed is idempotent and keeps the changes made by the administrator.

Cet article existe aussi en anglais

Discussion

Comments use a GitHub account.

Stay in touch

New logbook articles and delivered projects, by email, never too often.

Every email includes an unsubscribe link.