dsh-sheet-diff: Review CSV/XLSX changes by business primary keys

Introduction

In DeepSeek Harness (DSH), a common approach for agents to modify spreadsheets is to directly overwrite the file or save a new copy. If two tables differ only in the order of their rows or columns, a row-by-row comparison can easily mistake a simple “reordering” for massive modifications. If formulas are involved, one must also check for consistency between the formula text and the cached results saved by Excel. Without a read-only, locally accessible review step, it is difficult to clarify the risks involved before accepting changes.

Below is an introduction to the community plugin dsh-sheet-diff (Maintainer: po-et, Category: Workflow). It aligns two CSV or XLSX files by business primary keys and generates local HTML/JSON reports. It supports viewing values, types, formulas, and cached results in a browser, and allows exporting comment JSON to feed back into the Harness for further processing. The plugin does not edit workbooks, recalculate formulas, or upload data, nor does it require an API Key.

What is this

SheetDiff is a standalone DSH plugin that also provides a small CLI (sheet-diff). Its core positioning is: to perform a key-aligned change review before trusting AI-generated spreadsheets. GitHub Repository: po-et/dsh-sheet-diff; Community Directory Page: skillhub.cn Plugin Entry.

The first version (v0.1.0, MIT License) supports read-only comparison of CSV vs. CSV and XLSX vs. XLSX only; mixed formats will be rejected.

Core Features

Alignment by Key, Not by Row Number

During comparison, it uses the columns you specify as business primary keys (multiple --key flags can be used to form composite keys). Column names and key values must match exactly; composite keys include cell types, meaning the number 42 and the text "42" are treated as different. Duplicate keys, missing keys, or duplicate headers will cause immediate failure without guessing. Reordering of rows or columns should not generate meaningless cell changes (in the demo data, reordering rows and columns is not counted as a change).

What you can see in the report

The local HTML report allows filtering changes and distinguishes between:

  • Types such as numbers, text, booleans, dates, and errors (XLSX)
  • Formula text vs. saved formula cached results (cache is not recalculated)
  • Added/deleted rows, added/deleted columns, and structural changes

CSV files are comma-separated UTF-8, supporting quoted fields, embedded newlines, and BOM; the CSV side does not infer content as formulas.

Two Registered Harness Tools

Tool Main Inputs Result
sheet_diff_compare before, after, keyColumns, outputDir; optional sheet, headerRow New HTML/JSON paths, hashes, summary, and warnings
sheet_diff_review reportJson, reviewJson Validated comments and corresponding changes

Paths must fall within the current session workspace (including symlink resolution targets). Generating a report requires a writable sandbox; existing reports will not be overwritten. If the second write attempt fails, the tool will retain the first successfully written file rather than deleting it.

Review and Feedback

  1. Open the HTML report in a browser, filter changes, and write comments next to items requiring follow-up.
  2. Export the review JSON (drafts remain only in page memory and are written to disk only after export).
  3. Place the exported file and the original report.json within the workspace and call sheet_diff_review.

Comments must match the report ID, the hashes of the two input files, and known change IDs; expired or irrelevant reviews will be rejected. A matching hash does not guarantee the report hasn’t been manually tampered with; both comments and cell content are treated as untrusted data, and the plugin will not execute instructions contained within them or automatically modify the spreadsheet.

Scope and Limitations (Summary)

  • Single file input limit: 20 MiB; XLSX limits: 64 MiB after decompression, 8 MiB per ZIP fragment; limits for change records (10,000 entries) or serialized changes (24 MiB) are enforced—if exceeded, comparison fails without producing a “truncated but seemingly complete” report.
  • Does not compare workbook-wide formatting, merged cell layouts, charts, pivot tables, etc.; hidden data is still read, but “hidden status” is not compared.
  • Does not support legacy XLS, macros, encrypted packages, external links, etc. Date cells stored in ISO 8601 (e.g., openpyxl iso_dates=True) will be rejected; please re-export using numeric Excel dates.

The runtime environment requires Node.js 22.19 or higher (see engines in package.json). Installation and tool invocation have been tested on Harness 0.2.0-rc.2 and 0.2.1-alpha.2 (no model invocations).

Installation and Activation

The plugin is distributed via GitHub Releases and is not published to npm. To install to a specific profile, use the official command (version based on the v0.1.0 release package):

dsh plugin --profile YOUR_PROFILE add https://github.com/po-et/dsh-sheet-diff/releases/download/v0.1.0/dsh-sheet-diff-0.1.0.tgz

Restart the profile after installation. The package contains JavaScript and a dsh.bundle patch, with no plugin-side build steps or install scripts. You can also run npm pack in the source directory and install using the absolute local path of the generated tgz.

The DSH community directory is an independent site with no official affiliation with DeepSeek / High-Flyer; please review the repository source code and MIT license yourself before installation. The plugin accesses workspace files with the permissions of the current DSH process. Review reports may contain changed cell data, source file names, and hashes; please treat them as sensitive data.

Typical Usage

Drive via Natural Language in Harness

You can explain your intent to the agent, for example:

Compare before.xlsx and after.xlsx using OrderID as the key. Save a SheetDiff report in reviews/run-001. Do not change either workbook.

The interactive report needs to be opened in a JavaScript-capable browser; previews with JS disabled cannot use the comment controls on the page. This version does not have a built-in spreadsheet editor.

Directly Compare Two Files via CLI

After preparing before / after files in the working directory:

node src/cli.js before.xlsx after.xlsx --key OrderID --out review-001
node src/cli.js examples/before.csv examples/after.csv --key OrderID --out review-csv

--out must point to a newly created directory. Composite keys can be defined by repeating --key. --sheet Orders specifies the worksheet; --header-row 3 specifies the header row; otherwise, the default header row is the 1st row for all sheets and must include the selected key columns. CSVs logically consist of only one table named CSV.

CLI equivalent command for review JSON:

node src/cli.js review review-001/report.json review-comments.json

If the CLI is installed via the release package or npm pack, the sheet-diff binary can be used with arguments consistent with the node src/cli.js examples in the README.

Use Cases and Notes

Suitable for: Scenarios where an agent or script generates a “revised” spreadsheet, and you need to verify amounts, types, formulas, and cached results by primary keys (like order numbers or account numbers) before human review or a second Agent turn; workflows requiring structured feedback of review comments to the Harness.

Not suitable for: Scenarios requiring formula recalculation, writing back to Excel, or layout fidelity verification of the entire workbook; complex layouts with multiple tables mixed on a single sheet may require exporting them as separate tables before comparison.

For details on comparison rules, privacy, and development testing (npm test, npm run smoke:host), please refer to the GitHub README.

Conclusion

dsh-sheet-diff breaks “spreadsheet modification” into three steps: read-only comparison, local HTML review, and comment JSON feedback. It uses business primary keys to reduce noise caused by row/column reordering and displays formulas and cached results separately. If you frequently handle CSV/XLSX changes in DSH workflows, you can integrate this same workflow via sheet_diff_compare / sheet_diff_review or the CLI after installing the v0.1.0 release package and restarting your profile.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye