Build a Google Sheets data cleanup workflow with stable record IDs, duplicate checks, exception review and safe reruns before updating reports.

Start with the business record, not the row
A sales export arrives every morning. Someone pastes it below yesterday’s rows, refreshes the report and sends the totals. The file may include yesterday’s orders again, corrected amounts or a second line for the same order. A clean-looking spreadsheet can therefore produce the wrong number. The useful question is not simply “can we remove duplicates?” It is “which records represent the same business event, and what should happen when they change?”
For an order-level report, an order ID may identify one record. For a product-level report, the key may need both the order ID and line-item ID. Customer email alone is usually a poor order key: the same buyer can place several legitimate orders. Write the chosen rule down before selecting a formula, a menu command or a script.
Keep raw inputs separate from approved data
Use a small, explicit structure: Raw Imports, Validated Records, Exceptions and Import Log. Preserve the original values in Raw Imports and add the source file name, import time and batch ID. Validated Records contains only rows that pass the agreed checks. Reports read from that approved area rather than from whatever a colleague pasted most recently.
The separation makes a disputed total easier to explain. You can trace a reported order back to its source without guessing which cleanup step changed it. It also lets the team review a new batch before it affects a customer-facing report. Decide who can approve exceptions and who can edit the rules; those responsibilities belong in the workflow brief.
Normalize values without destroying meaning
Agree how the workflow handles spaces, date formats, currencies and blank fields. Keep identifiers as text when leading zeros matter: 00127 and 127 should not become interchangeable without a business decision. An ambiguous date such as 03/04/2026 needs an agreed source format. Do not silently guess whether the source means March 4 or April 3.
Missing amounts should not automatically become zero. A blank could mean “not supplied yet,” while zero could be a valid transaction value. Route ambiguous records to Exceptions with a reason and a suggested next action. For text imports, also agree how formula-like strings are treated so external values do not unexpectedly become executable spreadsheet formulas.
Decide what a duplicate actually means
Consider this illustrative batch. Order A-104 already exists for USD 120. One incoming row repeats A-104 at USD 120; another repeats A-104 at USD 125. The first may be an unchanged record that should be skipped. The second is a conflict or an update, depending on the source’s documented rules. Deleting both as duplicates would hide a possible correction.
Define three outcomes: insert a new key, skip an unchanged key, or review/update a changed key. If updates are allowed, specify which fields may change and which timestamp or version is authoritative. Check duplicates within the incoming file as well as against existing records. A unique key in the destination does not resolve conflicting versions in the same incoming batch.
Make reruns predictable before scheduling imports
A useful acceptance rule is: running the same completed batch again must not add a second copy of the same business record. Record batch status and processed keys so a restart can identify what was already written. Test an interruption after some writes, not only a perfectly completed run. A timestamp saying “started” is not evidence that the whole batch succeeded.
For Apps Script implementations, LockService can coordinate script executions that use the same lock, helping prevent overlapping import runs from entering a protected section together. It does not make Sheets a transactional database, stop ordinary human edits or coordinate unrelated scripts that ignore the lock. The recovery design still needs to handle partially completed work.
Performance also matters. Google recommends batching spreadsheet reads and writes rather than repeatedly reading and writing individual cells. That is an implementation technique, not a guarantee that any file size will work. Validate the expected workload and account limits with representative data before promising an unattended schedule.
Check the result with a small acceptance pack
Prepare a test file containing a new record, an exact duplicate, a changed amount, a missing key, a leading-zero identifier and an ambiguous date. Include two conflicting records in the same batch. Write the expected outcome next to each row before testing. A developer and a business reviewer should be able to agree on the result without interpreting the code.
Reconcile the batch using counts: received rows, inserted rows, updated rows, skipped rows and exceptions. If each input row receives one final outcome, those outcomes should add up to the received count. Reconcile monetary totals separately, by currency and the agreed reporting rules. Matching row counts alone cannot prove that sales totals are correct.
The handover should include the column contract, duplicate rules, exception owner, run log location and restart procedure. Keep a visible “last successful import” value so colleagues can distinguish a quiet day from a broken process. Then connect the approved records to your weekly reporting workflow.
When is a formula enough?
For a one-off review of a small, consistent dataset, formulas or built-in cleanup tools may be sufficient. A recurring process with conflicting versions, exception approval and recovery requirements benefits from a defined workflow. Start by documenting the rules, not by assuming that every spreadsheet needs custom code.
If several systems must update the same records with strict consistency, assess a database or application as the system of record. Sheets can remain a reporting or review interface. To scope a practical improvement, share an anonymized input sample, the current steps and examples of correct outputs with our Google Sheets Customization service, or discuss your workflow with GreyWhale.

