When an authorized catalog export lands in an analyst’s inbox, there are two jobs to do. The first is to preserve the source evidence. The second is to give someone a workbook that behaves as intended when they click a single cell, sort a column or save a new copy. I use 2scraper as the project reference on the job, then test the downstream workbook separately from the machine-readable file.
A catalog identifier such as 00412 has five meaningful characters even when all five happen to be digits. A supplier label can begin with a punctuation mark and still be entirely ordinary text. A spreadsheet application may assign a different type when it imports CSV using local defaults. The imported sheet can look plausible while silently changing the keys that a later join uses. The right place to see this is in the exported workbook and its cell types.
The analyst and the ingestion job have different requirements. The ingestion job benefits from canonical bytes, a declared CSV dialect and a manifest. The analyst benefits from an artifact with explicit types. I keep both outputs under the same run identifier and publish one data dictionary that tells each reader which artifact to use.
Separate the canonical artifact from the viewing copy
I keep the CSV immutable and make the analyst file an XLSX. Treat identifiers, titles and marketplace labels as text. Parse stock quantities as integers only in the importer, store currency alongside an amount, and validate that the displayed label can be traced to an unchanged source field. A numeric cell format can change what users see, so verify the stored type separately from the display.
The interface also needs a clear re-export story. If analysts download a new CSV from their workbook, that CSV belongs to an analyst workflow. It has a derivation reference and its own contract. Treating it as the primary ingestion file makes the same ambiguity reappear one step later. I leave the source read-only and put the viewing copy somewhere the analyst can annotate safely.
Check the saved cell types with a local fixture
The example uses openpyxl to create a file in memory and read it back. Install the project’s approved version of openpyxl in the test environment. The explicit string type is set after assigning a source value. The code reads the final artifact and tests exact equality for every text cell. It leaves missing stock blank.
from io import BytesIO from openpyxl import Workbook, load_workbook source = [('00412', '+ revised', 2), ('03-04', 'Supplier B', None)] result = Workbook() sheet = result.active sheet.append(['sku', 'label', 'on_hand']) for row, (sku, label, stock) in enumerate(source, start=2): for column, value in enumerate((sku, label), start=1): cell = sheet.cell(row, column, value) cell.data_type = 's' sheet.cell(row, 3, stock) artifact = BytesIO() result.save(artifact) artifact.seek(0) saved = load_workbook(artifact).active for row, (sku, label, stock) in enumerate(source, start=2): assert [saved.cell(row, c).data_type for c in (1, 2)] == ['s', 's'] assert [saved.cell(row, c).value for c in (1, 2, 3)] == [sku, label, stock] assert saved['C2'].data_type == 'n' assert saved['C3'].value is None print('2 IDs retained as text; stock 2 and unknown remain distinct') The local execution printed this output.
2 IDs retained as text; stock 2 and unknown remain distinct An in-memory workbook covers the writer and reader used in CI. For analyst-facing release acceptance I would also open the generated XLSX in each supported spreadsheet app, review the formula bar for the sample identifiers and save a disposable copy. A typed workbook survives the storage check. Importing its values through a different file format creates a new boundary worth documenting.
Read the fixture as a decision table
| Case | Evidence | Expected decision |
|---|---|---|
| Padded key | 00412 | five-character text |
| Date-like key | 03-04 | five-character text |
| Punctuation | + revised | unchanged text |
| Stock | 2 | numeric integer |
| Empty stock | blank | empty cell |
Padded key. The leading zeros distinguish the original business identifier from a value produced by numeric inference. Search for it after saving and reopening.
Date-like key. The same text can describe two different calendar dates on two analyst machines. Under the published schema this field is an identifier, so the date interpretation is irrelevant.
Punctuation. The stored type should still be a string. Match the value byte for byte after round trip, paying attention to an accidentally added apostrophe.
Stock. A worksheet should sum the stock column without first cleaning a text number. Document that this represents units on hand.
Empty stock. The absence of an observation must survive the viewing copy. A zero might represent an independently verified out-of-stock item.
Two offices opened the same file
Imagine an analyst in one office opens CSV directly and another imports the same file with a different locale. If they report different dates from a key such as 03-04, changing regional settings on one computer only hides the assumption. A typed viewing copy gives both readers the same stored content. I would still include a workbook smoke test with the two configurations used in reporting, because visual formats belong to the application.
An automated downstream job can stumble the same way. When a worksheet is turned back into a CSV, an identifier may keep the visible formatting even though the underlying evidence is gone. Leading zeros restored by number formatting can produce an apparent fix while two distinct source keys have already coalesced. Test uniqueness at both boundaries, before conversion and after the final artifact is reopened.
A third trap is stripping all punctuation as an emergency measure. It leaves joins harder to diagnose and corrupts quality labels that were perfectly valid. Keep the original string and assign a text type. If an approved transformation removes formatting characters, publish the rule for that field separately and include an example where applying it would merge two records.
What to do when a column changes meaning
Someone may add a new column to the upstream project and label it pack size. If the field is used as an identifier, leave it as text. If it represents a quantity, define the unit, validate acceptable values and give the worksheet a separate column for the display label. Updating the metadata and a test together makes that review explicit. Copying the previous inferred behavior will not answer which meaning the users rely on.
Keep type-conversion errors in the job summary with a field name and a per-run count. Showing the literal content in a shared alert can reveal supplier data. Give the analyst a stable row reference and a documented route to the approved artifact. A fatal parse can block the viewing copy while leaving the source file in the restricted location available for investigation.
Review the first delivery with an analyst
Ask an analyst to open the workbook, sort by stock and look up a key that begins with zero. Ask them to reproduce the same total from the canonical extract with a declared schema. Compare the record counts and identifiers using a separate reader. Include a row with blank stock and a row with zero stock so the distinction is visible during the review.
Decide how users will find the most recent successful viewing copy. I publish an artifact listing with the run identifier, schema version and build status. If the new worksheet cannot be verified, the index can point to the latest good file with its age displayed. This preserves an immediately usable artifact without conflating it with the current run.
What I would retain for the next review
For the first deployment, I would keep a small directory of approved examples beside the code that reads authorized catalog export. Keep the unmodified source fixture and the derived record in separate files. If you only keep the winner or the visible dashboard row, you lose the inputs that made the decision about text-typed identifiers explainable. Include an example the program explicitly rejected and an example that legitimately passed. A reviewer should be able to identify which is which from the inputs before opening the expected result.
I would give the report owner a short checklist with one entry for the source SKU, artifact digest and actual cell type. The first check is whether two readers can independently point to the same underlying record. The second is whether they agree about the decision under the documented rule. The third is whether a discrepancy about a number inferred from a SKU becomes visible to the person who can resolve it. Keep an expected output in the test directory and a human-readable account in the release notes. They serve different readers and should describe the same decision.
I would have the test report more than a pass count. Give the failing case a stable name and preserve the decision stage where it stopped. That makes it possible to compare results months later after a field has been renamed or a report has moved. Count missing evidence independently of invalid evidence. A problem with collection can look like a problem with the rule if both types land in the same generic error bucket. The difference is consequential for whoever will support authorized catalog export.
For rollout, run the new rule next to the existing report for one real reporting interval and compare individual cases, using only data already approved for that workflow. Keep the previous version available until you can explain every material difference in product identity or totals. Record a representative changed row with the source identifier and the rule version. Then look at a small sample of unchanged rows so the release review can also say what the change preserved. The useful output is a reproducible decision, plus a record of where the rule needs more evidence.
I would make the handoff include a deliberate bad run. Remove the evidence for a number inferred from a SKU from a copy of the fixture while leaving the rest of the records intact. Ask the operator to identify the first place where the uncertainty appears, then try the diagnosis using only the artifacts that someone on call can access. If the needed evidence can only be reached through an administrator’s personal workspace or an undocumented manual step, give the review a shared run reference before rollout. The exercise is complete when the operator can explain which conclusions about text-typed identifiers remain available and can reproduce them with a clean copy. Keep the failing input in the test suite as a fixture, with real records and any access tokens excluded.
Make this the first test for a new catalog
Choose one supported project from 2scraper, run a small authorized export and identify the columns analysts join on. Save the canonical extract and share a separately named typed workbook. Ask a second reader to verify the troublesome keys before you put the analyst copy in a recurring report.
Prepared with AI assistance. The code was run locally against a synthetic fixture. The fixture describes the downstream workflow illustrated here.
Further reading
Verify the Exact Product Set in a Filtered 2scraper Export A row-level check for the source extract.
Check Price and Stock Units in a 2scraper Catalog Export A companion set of checks for numeric fields.
