ClarentBook a pilot call
Blog

How to validate and reconcile a customer CSV migration

The steps to take with a customer CSV: file checks, spreadsheet damage, field rules, a versioned mapping, an approval gate and a reconciliation that adds up.

Every source row has to end in one of three states: imported, rejected with a reason, or unresolved, and the sum of those three counts has to match the source row count. Before starting an import that writes anything, you validate the file and get the customer's approval on the mapping and a preview.

Agree what "accepted" means before the file arrives

Put the acceptance terms for the data in writing at the start. Nobody can cite a result yet, so nobody can argue from one. Agree on:

  • The expected row count, or how you will count rows in the source system to confirm it.
  • The required fields and the key that identifies every record.
  • The sample checks: how many records get compared field by field, and who picks them.
  • The person on the customer side who will sign the reconciliation.

Receive and pin the file

When the file arrives, enter its name, its row count and a checksum or hash. Store it in a place where nobody edits it. With that fingerprint, you can later prove that the file the customer approved is the file that ran. If the customer sends a corrected file, treat it as a new file, with a new fingerprint and a new approval.

Check the structure

RFC 4180 is an informational memo that "does not specify an Internet standard of any kind". It says CSV has no formal specification and that implementations differ considerably, but the format it documents still makes a usable checklist. Each line should carry the same number of fields. A field that contains a comma, a double quote or a line break should be enclosed in double quotes. You escape a double quote inside a quoted field by doubling it. The file may or may not have a header line.

Check each of these and report problems by row number:

  • Field count per row. One field too many often means an unquoted comma in an address or a name.
  • Quoting. A quoted comma or line break should parse as one field, and a doubled quote should come out as a single quote.
  • The header row. It is present, or confirmed absent, and its names match the mapping.
  • The encoding. RFC 4180 says US-ASCII is the common practice and that other character sets can be declared with a "charset" parameter. Don't guess. Ask which character set the customer's export uses, then read a few rows with accented names after parsing.

Look for spreadsheet damage

A file that was passed through Excel on its way to you may have changed without anyone noticing. Microsoft's support page says Excel automatically removes leading zeros and converts large numbers to scientific notation, such as 1.23E+15. Its examples include account numbers, product codes, phone numbers and postal codes. Excel also keeps at most 15 significant digits. In a number with 16 or more digits, every digit past the 15th becomes zero. The same page lists one more conversion: a continuous string of letters and numbers can turn into a date.

The page also notes that once leading zeros are removed, it is too late to bring them back by applying a format. Reformatting the column will not cure the damage, so ask for the original export from the source system. Then take a handful of IDs with leading zeros or long digit strings and compare them with the original records on the customer's source system screen.

Write the field rules

Example: Site records.

FieldRuleWhat failsWhat to do
Site IDRequired, unique, kept as textBlank, duplicate, or leading zeros lostReject blanks and duplicates. For lost zeros, get the original export
NameRequiredBlankReject with the reason
CityOptional, textA value that looks like a date or a codeFlag for review and import as given
RegionRequired from scope v4. One of 6 picklist valuesBlank, or a value outside the listReject blanks. Map spelling variants only with the customer's approval
Parent accountMust match an existing account in the destinationNo match foundHold as unresolved until the customer names the account

Version the mapping

The mapping is a record of where each source column goes and who decided it. Give it a version number, and any change made after approval creates a new version. Here is an example for the same Site records:

Source columnDestination fieldTransformationRuleDecided by
site_idSite IDTrim spaces, keep as textRequired, uniqueImplementation lead
regionRegionMap north and N to NorthOne of 6 valuesCustomer admin
parent_refParent accountLook up by account numberMust existCustomer admin

Preview before you run

Run the import in a test environment, or as a dry run that writes nothing, and split the result into three counts: records to create, records to update and records to reject. Each rejection carries the reason why. Show the customer admin a sample of each group, including a few rejections. If a preview of a real customer file shows zero rejections, that is a signal to check the rules again.

Approve against the file and the mapping

Two people approve two different things: the customer admin owns the data and approves the mapping and the preview, and the implementation lead confirms the run is ready. The configuration the data depends on exists, the target environment is the right one, and the run window is agreed. In this case the Region field has to exist in the account before the import runs, which is why configuration comes before data in a repeatable configuration process.

The approval record holds the file fingerprint, the mapping version, the preview counts, the approver's name and the time. If any of those change, the approval will no longer cover the run, and the import stays blocked until a matching approval exists.

If you are choosing software to coordinate this, check three points. An import should be unable to start without an approval that matches the file fingerprint and the mapping version. A blocked import should state what is missing and who can approve it. The approval should be filed with the run it authorized.

Run it so a retry is safe

Match records on a stable key, here the Site ID, so a rerun updates the record it created the first time and never adds a duplicate. Keep a record of each row: created, updated, rejected with a reason, or not processed. When some rows fail, correct them and rerun only those rows against the same key.

Reconcile every row

Example: the reconciliation for customer_sites.csv.

OutcomeRowsWhat happens next
Source rows1,241Matches the pinned file and its fingerprint
Imported1,204Spot-checked against the source
Rejected37Reason: Region is empty. The customer admin decides whether to supply regions or leave those Sites out
Unresolved0Each would need a decision and an owner

Add the three outcomes and check that the total matches the source rows. If the figures do not add up, rows went missing between the file and the run log, and nothing gets signed until you find them.

Then spot-check. Pick out records from across the file, including the first and last rows and any with quoted commas or long IDs, and compare every field in the destination with the source. The Region requirement behind the 37 rejections began as a question on a kickoff call. Tracing that change shows how the requirement reached scope v4.

The reconciliation report is signed by the customer once each of the 37 rejected rows has a decision recorded against it. The report holds the counts, the rejection list with each decision, the spot-check results, the file fingerprint and the mapping version. It goes into the handover evidence as it is.

Where Clarent is headed

Clarent is pre-launch and has shipped nothing. It is being built to support a defined source format and destination. The plan is to propose mappings and transformations, validate the data, preview the result, run an approved import and reconcile it, so every imported, rejected and unresolved record is accounted for. Imports are planned to need the approvals your team defines, show a preview first and leave an execution record. A blocked import is meant to show the missing condition and the approver who can clear it. The first release is planned around one defined import path, chosen with pilot customers.

We run paid pilots on one real implementation at a time, each at a fixed fee for a defined scope agreed before work starts. Software vendors who import customer data on every deal will find more on the page for software vendors. To talk over one of your migrations, book a 30-minute call.

Sources

  1. 1.
  2. 2.
    Keeping leading zeros and large numbers (Microsoft Support)

    support.microsoft.com · Checked

Paid pilot

Start with one implementation.

Before a paid pilot starts, we agree scope, fee, responsibilities, acceptance checks and support. We watch cost and result: the whole delivery effort with review and exceptions, engineer hours on known steps, and time from agreed scope to acceptance, against your current process.