{"id":13594305,"url":"https://github.com/na-ka-na/ExcelCompare","last_synced_at":"2025-04-09T07:31:31.241Z","repository":{"id":3764962,"uuid":"4841359","full_name":"na-ka-na/ExcelCompare","owner":"na-ka-na","description":"Command line tool (and API) for diffing Excel Workbooks","archived":false,"fork":false,"pushed_at":"2023-10-17T07:38:05.000Z","size":257,"stargazers_count":832,"open_issues_count":21,"forks_count":102,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-03-07T20:45:21.433Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/na-ka-na.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2012-06-30T09:36:26.000Z","updated_at":"2025-03-05T18:46:01.000Z","dependencies_parsed_at":"2022-08-29T09:41:53.417Z","dependency_job_id":"f7d5c808-4aba-456b-8ae0-e94c035ad614","html_url":"https://github.com/na-ka-na/ExcelCompare","commit_stats":{"total_commits":128,"total_committers":8,"mean_commits":16.0,"dds":0.359375,"last_synced_commit":"1214ffdb215646feb1a14744d18c10b508e60902"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-ka-na%2FExcelCompare","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-ka-na%2FExcelCompare/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-ka-na%2FExcelCompare/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/na-ka-na%2FExcelCompare/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/na-ka-na","download_url":"https://codeload.github.com/na-ka-na/ExcelCompare/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247808926,"owners_count":20999802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T16:01:31.538Z","updated_at":"2025-04-09T07:31:30.824Z","avatar_url":"https://github.com/na-ka-na.png","language":"Java","funding_links":[],"categories":["Java","文件操作"],"sub_categories":["Excel库"],"readme":"## Introduction\n\nExcelCompare is a command line tool (coming soon API) to diff Excel / Open document (ods) (Open office, Libre office) spreadsheets.\n\nIt uses the [Apache POI](http://poi.apache.org) library to read Excel files.\nAnd the [OdfToolkit] (http://incubator.apache.org/odftoolkit) library to read Open document (ods) files.\n\nThis software is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.\n\n## Features / Limitations\n\n* Identifies extra cells / sheets in addition to common cells.\n* Prints all diffs \u0026 extra cells on stdout.\n* Process exits with 0 if workbooks match, 1 otherwise.\n* Works with xls, xlsx, xlsm, ods. You may compare any of these with each other.\n* Compares only cell \"contents\". Formatting, macros are currently ignored.\n* Using --ignore1 \u0026 --ignore2 (both optional) you may tell the diff to skip any number of sheets / rows / columns / cells.\n* Other flags to control diffing (see below for description of these): --diff_numeric_precision, --diff_ignore_formulas, --diff_format.\n\nReport bugs / issues / requests [here](https://github.com/na-ka-na/ExcelCompare/issues)\n\n## Installation\n\n### Prerequisites\n\n* Requires Java 1.8 or higher.\n* Assumes Java is added to PATH (to check open a cmd and run java -version)\n* No other platform specific requirements\n* A shell script and a bat script are packaged\n\nJust [download](https://github.com/na-ka-na/ExcelCompare/releases) the zip file.\n\nExtract it anywhere (and optionally you add the extracted folder to PATH).\n\n### macOS\n\n[Homebrew](http://brew.sh/) makes it easy to install ExcelCompare:\n\n    $ brew update\n    $ brew install excel-compare\n\n## Usage\n\n    $ excel_cmp \u003cdiff-flags\u003e \u003cfile1\u003e \u003cfile2\u003e [--ignore1 \u003csheet-ignore-spec\u003e ..] [--ignore2 \u003csheet-ignore-spec\u003e ..]\n\nNotes:\n\n* --ignore1 (file1) and --ignore2 (file2) are independent of each other\n* Give one and only one \u0026lt;sheet-ignore-spec\u003e per sheet\n* File path is assumed relative to current directory unless full path is provided\n* file1 and/or file2 can be '/dev/null' or '\\\\.\\NUL' (on windows) which is treated as empty file. This is useful for using ExcelCompare for git diff.\n\n### Diff flags\n\n* --diff_numeric_precision: by default numbers are diffed with double precision, to change that specify this flag as --diff_numeric_precision=0.0001\n* --diff_ignore_formulas: by default for cells with formula, formula is compared instead of the evaluated value. Use this flag to compare evaluated value instead\n* --diff_format: by default output is in 'excel_cmp' format, use --diff_format=unified to output in Unified Diff format instead\n\n### Sheet Ignore Spec\n    \u003csheet-name\u003e:\u003crow-ignore-spec\u003e:\u003ccolumn-ignore-spec\u003e:\u003ccell-ignore-spec\u003e\n\n* Leaving \u0026lt;sheet-name\u003e blank corresponds to this spec applying to all sheets, for example ::A will ignore column A in all sheets\n* To ignore whole sheet, just provide \u0026lt;sheet-name\u003e\n* Any cell satisfying any ignore spec in the sheet (row, col, or cell) will be ignored in diff\n* You may provide only \u0026lt;cell-ignore-spec\u003e as - \u0026lt;sheet-name\u003e:::\u0026lt;cell-ignore-spec\u003e\n\n### Row Ignore Spec\n    \u003ccomma sep list of row or row-range\u003e\n\n* Row numbers begin from 1\n* Range of rows may be provide as: 1-10\n* Rows and ranges may be mixed as: 1-10,12,20-30 etc.\n\n### Column Ignore Spec\n    \u003ccomma sep list of column or column-range\u003e\n\n* Similar to Row Ignore Spec\n* Columns are letters starting with A\n\n### Cell Ignore Spec\n    \u003ccomma sep list of cell or cell-range\u003e\n\n* Similar to Row Ignore Spec\n* Cells are in usual Excel notation A1 D10\n* Range may be provided as A1-D10\n\n### Examples\n\n* Diff all cells\n\n        excel_cmp 1.xlsx 2.xlsx\n    \n* Ignore Sheet1 in 1.xlsx\n    \n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1\n \n* Ignore Sheet1 in both\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1 --ignore2 Sheet1\n\n* Ignore column A in both \n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1::A --ignore2 Sheet1::A\n        \n* Ignore column A across all sheets in both \n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 ::A --ignore2 ::A\n\n* Ignore columns A,D and rows 1-5, 20-25\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1:1-5,20-25:A,D --ignore2 Sheet1:1-5,20-25:A,D\n\n* Ignore columns A,D and rows 1-5, 20-25 and cells F6,H8\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1:1-5,20-25:A,D:F6,H8 --ignore2 Sheet1:1-5,20-25:A,D:F6,H8\n\n* Ignore column A in Sheet1 and column B in Sheet2\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet1::A Sheet2::B --ignore2 Sheet1::A Sheet2::B\n\n* Ignore cells A1-B10 in Sheet2 of both files\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 Sheet2:::A1-B10 --ignore2 Sheet2:::A1-B10\n\n* Ignore column A in all sheets of both files\n\n        excel_cmp 1.xlsx 2.xlsx --ignore1 ::A --ignore2 ::A\n\n## Native (\"excel_cmp\") Output format\n* Each diff or extra cell is reported per line as follows\n\n        DIFF  Cell at      \u003cCell\u003e =\u003e \u003cValue1\u003e v/s \u003cValue2\u003e\n        EXTRA Cell in \u003cWB\u003e \u003cCell\u003e =\u003e \u003cValue\u003e\n\n* Then a summary\n\n        ----------------- DIFF -------------------\n        Sheets: [\u003cSet of sheets with diffs\u003e]\n        Rows: [\u003cSet of rows with diffs\u003e]\n        Cols: [\u003cSet of columns with diffs\u003e]\n        ----------------- EXTRA WB1 -------------------\n        Sheets: [\u003cSet of extra sheets in WB1\u003e]\n        Rows: [\u003cSet of extra rows in WB1\u003e]\n        Cols: [\u003cSet of extra columns in WB1\u003e]\n        ----------------- EXTRA WB2 -------------------\n        Sheets: [\u003cSet of extra sheets in WB2\u003e]\n        Rows: [\u003cSet of extra rows in WB2\u003e]\n        Cols: [\u003cSet of extra columns in WB2\u003e]\n        -----------------------------------------\n\n* Then one line\n\n        Excel files \u003cfile1\u003e and \u003cfile2\u003e differ|match\n\n### Examples\n\n* Diffs in cells and extra cells\n\n```\n\u003e excel_cmp xxx.xlsx yyy.xlsx\nDIFF  Cell at     Sheet1!A1 =\u003e 'a' v/s 'aa'\nEXTRA Cell in WB1 Sheet1!B1 =\u003e 'cc'\nDIFF  Cell at     Sheet1!D4 =\u003e '4.0' v/s '14.0'\nEXTRA Cell in WB2 Sheet1!J10 =\u003e 'j'\nEXTRA Cell in WB1 Sheet1!K11 =\u003e 'k'\nEXTRA Cell in WB1 Sheet2!A1 =\u003e 'abc'\nEXTRA Cell in WB2 Sheet3!A1 =\u003e 'haha'\n----------------- DIFF -------------------\nSheets: [Sheet1]\nRows: [1, 4]\nCols: [A, D]\n----------------- EXTRA WB1 -------------------\nSheets: [Sheet1, Sheet2]\nRows: [1, 11]\nCols: [B, K, A]\n----------------- EXTRA WB2 -------------------\nSheets: [Sheet1, Sheet3]\nRows: [10, 1]\nCols: [J, A]\n-----------------------------------------\nExcel files xxx.xlsx and yyy.xlsx differ\n```\n\n* Only extra cells\n\n```\nexcel_cmp xxx.xlsx yyy.xlsx --ignore1 Sheet1 --ignore2 Sheet1\nEXTRA Cell in WB1 Sheet2!A1 =\u003e 'abc'\nEXTRA Cell in WB2 Sheet3!A1 =\u003e 'haha'\n----------------- DIFF -------------------\nSheets: []\nRows: []\nCols: []\n----------------- EXTRA WB1 -------------------\nSheets: [Sheet2]\nRows: [1]\nCols: [A]\n----------------- EXTRA WB2 -------------------\nSheets: [Sheet3]\nRows: [1]\nCols: [A]\n-----------------------------------------\nExcel files xxx.xlsx and yyy.xlsx differ\n```\n\n* No diff\n\n```\nexcel_cmp xxx.xlsx yyy.xlsx --ignore1 Sheet1 Sheet2 Sheet3 --ignore2 Sheet1 Sheet2 Sheet3\n----------------- DIFF -------------------\nSheets: []\nRows: []\nCols: []\n----------------- EXTRA WB1 -------------------\nSheets: []\nRows: []\nCols: []\n----------------- EXTRA WB2 -------------------\nSheets: []\nRows: []\nCols: []\n-----------------------------------------\nExcel files xxx.xlsx and yyy.xlsx match\n```\n\n## Unified Diff output format\n* Diffs are reported in the \"unified diff\" style, with no surrounding context (_i.e._, a la `diff -U0`).\n* Each sheet containing a diff or an extra cell begins with a header as follows:\n\t\t--\u003cFileName1\u003e!\u003cSheetName\u003e\n\t\t++\u003cFileName2\u003e!\u003cSheetName\u003e\n* Each row containing a diff or an extra cell begins with a line that identifies a contiguous series of cells in the row as follows:\n\t\t@@ \u003cRow\u003e\u003cColumnM\u003e,\u003cRow\u003e\u003cColumnN\u003e \u003cRow\u003e\u003cColumnM\u003e,\u003cRow\u003e\u003cColumnN\u003e  @@\n* Each diff or extra cell is reported as follows:\n\t\t-\u003cColumnMValue1\u003e\n\t\t-...\n\t\t-\u003cColumnNValue1\u003e\n\t\t+\u003cColumnMValue2\u003e\n\t\t+...\n\t\t+\u003cColumnNValue2\u003e\n* If there are multiple series of diff or extra cells, the row header and cell data will be repeated, with the column numbers idetifying the start and end of each series.\n* There is no summary, and if there are no diffs and no extra cells, the output is empty.\n\n### Examples\n\n* Diffs in cells and extra cells\n\n```diff\n\u003e excel_cmp --diff-format=unified xxx.xlsx yyy.xlsx\n--- xxx.xlsx!Sheet1\n+++ yyy.xlsx!Sheet1\n@@ A1,B1 A1,B1 @@\n-a\n-cc\n+aa\n+\n@@ D4 D4 @@\n-4.0\n+14.0\n@@ J10 J10 @@\n-\n+j\n@@ K11 K11 @@\n-k\n+\n--- xxx.xlsx!Sheet2\n+++ yyy.xlsx!Sheet2\n@@ A1 A1 @@\n-abc\n+\n--- xxx.xlsx!Sheet3\n+++ yyy.xlsx!Sheet3\n@@ A1 A1 @@\n-\n+haha\n```\n\n* Only extra cells\n\n```diff\n\u003e excel_cmp --diff-format=unified xxx.xlsx yyy.xlsx --ignore1 Sheet1 --ignore2 Sheet1\n--- xxx.xlsx!Sheet2\n+++ yyy.xlsx!Sheet2\n@@ A1 A1 @@\n-abc\n+\n--- xxx.xlsx!Sheet3\n+++ yyy.xlsx!Sheet3\n@@ A1 A1 @@\n-\n+haha\n```\n\n* No diff\n\n```diff\n\u003e excel_cmp --diff-format=unified xxx.xlsx yyy.xlsx --ignore1 Sheet1 Sheet2 Sheet3 --ignore2 Sheet1 Sheet2 Sheet3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna-ka-na%2FExcelCompare","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fna-ka-na%2FExcelCompare","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fna-ka-na%2FExcelCompare/lists"}